You need to sign in to do that
Don't have an account?
S S Malik
|DEBUG|The status code returned was not expected: 200 OK
Hello friends
I am doing the POST Request and trying to add a value to current availble JSON
and Getting the error
" |DEBUG|The status code returned was not expected: 200 OK"
and my code is
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://www.itutorlms.com/test.php');
request.setMethod('POST');
request.setHeader('Content-Type', 'application/json;charset=UTF-8');
// Set the body as a JSON object
request.setBody('{"name":"sukhbir"}');
HttpResponse response = http.send(request);
// Parse the JSON response
if (response.getStatusCode() != 201) {
System.debug('The status code returned was not expected: ' +
response.getStatusCode() + ' ' + response.getStatus());
} else {
System.debug(response.getBody());
}
and please suggest me any particular website for learning callouts and API step by step
Thanks in advance
I am doing the POST Request and trying to add a value to current availble JSON
and Getting the error
" |DEBUG|The status code returned was not expected: 200 OK"
and my code is
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://www.itutorlms.com/test.php');
request.setMethod('POST');
request.setHeader('Content-Type', 'application/json;charset=UTF-8');
// Set the body as a JSON object
request.setBody('{"name":"sukhbir"}');
HttpResponse response = http.send(request);
// Parse the JSON response
if (response.getStatusCode() != 201) {
System.debug('The status code returned was not expected: ' +
response.getStatusCode() + ' ' + response.getStatus());
} else {
System.debug(response.getBody());
}
and please suggest me any particular website for learning callouts and API step by step
Thanks in advance
You can start from trail head training module to learn Callouts and API.
https://trailhead.salesforce.com/en/apex_integration_services/apex_integration_rest_callouts
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/errorcodes.htm
Hope this helps you!
If this helps you mark it as solved.
Thanks and Regards
Sandhya