function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
robboermanrobboerman 

random JSON_PARSER_ERROR in REST GET call (HTTP entity body is required)

Hi, 

 

We are integrating a hybrid app with the REST API but are getting random errors from SalesForce. I have logged 2 instances of the app running in which a call is correctly handled and another where an error is returned by the REST API. The thing is... the 2 calls seem to be identical aside from an AccessToken that has been refreshed already and a single attribute (lastModified date) in the query.

 

The REST API complains that the Entity Body is empty when in fact I think that is always empty in a GET call. Can anyone help me out? This is realy driving me bonkers because it seems to go wrong at random intervals

 

CALLS: (OAUTH token removed)

Call correctly handled: 

 

{
"request": {
"id": null,
"headers": {
"Authorization": "OAuth *************************************",
"X-User-Agent": "salesforce-toolkit-rest-javascript/v24.0",
"X-Requested-With": "XMLHttpRequest"
},
"options": {
"method": "GET",
"url": "https://cs13.salesforce.com/services/data/v24.0/query?q=SELECT%20Id%2C%20OwnerId%2C%20IsDeleted%2C%20Name%2C%20CreatedDate%2C%20CreatedById%2C%20LastModifiedDate%2C%20LastModifiedById%2C%20SystemModstamp%2C%20FIELDBUDDY__Date__c%2C%20FIELDBUDDY__User__c%2C%20FIELDBUDDY__Total_Mileage__c%2C%20FIELDBUDDY__Total_Time_Hours__c%2C%20FIELDBUDDY__Total_Time_Minutes__c%20FROM%20FIELDBUDDY__Timesheet__c%20WHERE%20%28%20FIELDBUDDY__USER__C%20%3D%20%2700520000001DD9eAAG%27%20%29%20%20AND%20LastModifiedDate%20%3E%202012-08-22T22%3A23%3A59.068Z",
"disableCaching": true,
"headers": {
"Authorization": "OAuth *************************************",
"X-User-Agent": "salesforce-toolkit-rest-javascript/v24.0"
},
"jsonData": ""
},
"async": true
},
"requestId": null,
"status": 200,
"statusText": "OK",
"responseText": "{\"totalSize\":0,\"done\":true,\"records\":[]}",
"responseXML": null
}

 

 

Call resulting in an error:

 

{
"request": {
"id": null,
"headers": {
"Authorization": "OAuth *************************************",
"X-User-Agent": "salesforce-toolkit-rest-javascript/v24.0",
"X-Requested-With": "XMLHttpRequest"
},
"options": {
"method": "GET",
"url": "https://cs13.salesforce.com/services/data/v24.0/query?q=SELECT%20Id%2C%20OwnerId%2C%20IsDeleted%2C%20Name%2C%20CreatedDate%2C%20CreatedById%2C%20LastModifiedDate%2C%20LastModifiedById%2C%20SystemModstamp%2C%20FIELDBUDDY__Date__c%2C%20FIELDBUDDY__User__c%2C%20FIELDBUDDY__Total_Mileage__c%2C%20FIELDBUDDY__Total_Time_Hours__c%2C%20FIELDBUDDY__Total_Time_Minutes__c%20FROM%20FIELDBUDDY__Timesheet__c%20WHERE%20%28%20FIELDBUDDY__USER__C%20%3D%20%2700520000001DD9eAAG%27%20%29%20%20AND%20LastModifiedDate%20%3E%202012-08-22T21%3A27%3A24.515Z",
"disableCaching": true,
"headers": {
"Authorization": "OAuth *************************************",
"X-User-Agent": "salesforce-toolkit-rest-javascript/v24.0"
},
"jsonData": ""
},
"async": true
},
"requestId": null,
"status": 400,
"statusText": "Bad Request",
"responseText": "[{\"message\":\"The HTTP entity body is required, but this request has no entity body.\",\"errorCode\":\"JSON_PARSER_ERROR\"}]",
"responseXML": null
}