2

I have a few json's that I'm posting with the access-token as header, when I send two parameters I get a status message from my rest api successfully, but when I send more than 2 parameters I get the following error:

{
  "message" : "Unexpected parameter encountered during deserialization: <keyName> at [line:3, column:16]",
  "errorCode" : "JSON_PARSER_ERROR"
}

I enter the same json I give as input in the workbench and there seems to be no error, I get a custom status message atleast even if there are no values retrived(given below):

{
"statusReason":"No records were found with submitted criteria.",
"Accountid":"XXXXXXXXXXXXXXXX",
"SOACount":"0",
"SOAs":null,
"status":"Failure"
}

any one who knows the answer to this bizarre problem...let me know why. WHY ONLY 2?????? my api works, else it would not retrieve the values on work bench! I send the same JSON in both cases, I assure you that! is there some permission or something? then it shouldn't run for any case right? why run where there are 2 parameters??

INPUT JSON:

{
 "AccountId":"UxooAgHab001gUm",
 "Key":"okay",
 "startdate":"2016-12-17"
}

REST API CODE:

@HttpPost
Global static APIService.Response OutREST(String AccountId, String Key, String startdate)
{
    APIService.Response response = APIHandler.getData('REST', accountId, Key, startdate, null , null, false);
    return response;
}
  • Can you add your JSON input and the webservice details ? – Mohith Shrivastava Feb 12 '17 at 17:19
2

Notice that you have Invalid JSON for input ,The correct JSON can be validated at JSONlint.com

Here is the corrected JSON try this

{
"AccountId": "UxooAgHab001gUm",
"Key": "okay",
"startdate": "2016-12-17"
}

Carefully notice the comma you have after third parameter .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.