I ran your API and found that your response still has the extra \n characters in it that the Javascript callout was supposed to fix.
Here is the response I got:
{
"jokeid":"3229",
"title":"Advice for Idiots",
"body":"An actual tip from page 16 of the HP "Environmental,Health & Safety Handbook for Employees": \n\n "Blink your eyelids periodically to lubricate your eyes."",
"rating":"G",
"img":"",
"modified":"2000-07-31"
"comments":["This is very funny",
"OMG so funny!"
]
}
Here is a typical response that is expected:
{
"jokeid": "3229",
"title": "Advice for Idiots",
"body": "An actual tip from page 16 of the HP "Environmental,Health & Safety Handbook for Employees": "Blink your eyelids periodically to lubricate your eyes."",
"rating": "G",
"img": "",
"modified": "2000-07-31",
"comments": [
"Hi There",
"This is a comment2"
]
}
Notice that the \n’s are removed. Your Javascript should look something like this:
var myvar = context.getVariable("jokeresponse.body");
myvar = myvar.replace("\\n", "", "g");
context.setVariable("jokeresponse.body", myvar);
You should attach the Javascript callout to the Joke Details response. Within trace you should be able to see the jokeresponse.body changed to delete those characters.
I believe you are failing because of the extra \n characters in the response body. If you can get your Javascript callout to remove them and you are still failing, please let us know at help@apigee.com and we’ll adjust your grade accordingly. It does appear that your callout to the comments database is working correctly, so you are quite close.