React Native
React Native
Send a REST Request with No Body
See more REST Examples
Demonstrates Rest.FullRequestNoBody, which sends a complete request with no request body (such as a GET or DELETE) and returns the response body as text.
Background. This is the simplest full-request convenience method, ideal for retrieval and deletion calls that carry no request payload.
Chilkat React Native Downloads
import { Rest } from '@chilkat/react-native'
async function chilkatExample() {
const rest = new Rest();
const bTls = true;
const bAutoReconnect = true;
try {
await rest.connectAsync('example.com', 443, bTls, bAutoReconnect);
} catch {
console.log(rest.lastErrorText);
return;
}
// Send a complete request with no request body, such as a GET or DELETE. The response body is read
// as text and returned.
let responseText: string;
try {
responseText = await rest.fullRequestNoBodyAsync('GET', '/api/items/123');
} catch {
console.log(rest.lastErrorText);
return;
}
console.log(responseText);
}