JSON PARSE ERROR 200 Unexpected token - ajax

I got this error from my jquery ajax request. ERROR 200 Unexpected token
Here is my JSON :
{
"data": [
{
"answer": "sofo",
"email": "jk#gmail.com",
"secretquestion": "bestfriend"
}
],
"status": 1,
"message": "Success!"
}
I validated on JSONLint and i got Unexpected token. I cant understand my fault. Do u have any ideas?
Thank you

The JSON is valid. There may be a difference in the token name (a spelling mistake?) when you are deserializing it.

Related

Google APi Bad Request

i try to implement Passes service of Google Api in our website but we always have error 400 problem
we follow this documentation
Giftcardclass: insert
i use postman for test
POST https://www.googleapis.com/walletobjects/v1/giftCardClass
Request body
{
"kind":"walletobjects#loyaltyObject",
"id":"test2.test",
"classId":"test.test",
"version":12,
"state":"active",
"issuername":"dsadasdasdas",
"barcode":{
"kind":"walletobjects#barcode",
"type":"ean13",
"value":"aaaa",
"alternateText":"aaaa"
}
}
jSon response
{ "error": {
"errors": [
{
"domain": "global",
"reason": "invalidArgument",
"message": "Bad Request"
}
],
"code": 400,
"message": "Bad Request" }
}
from the documentation seems that only id,issuerstate and reviewStatus are required.
Looks like your ids are formatted wrongly, it should be issuer_id.unique_id. See https://developers.google.com/pay/passes/rest/v1/giftcardclass#GiftCardClass.FIELDS.id for reference.

Invalid CSRF Token 'null'

I referred "https://github.com/mswiderski/jbpm-examples/tree/master/spring-boot-jbpm it runs well for GET request.
Now I am trying following code
#RequestMapping(value="/test" ,method=RequestMethod.POST)
public String test(#RequestBody String emp){
System.out.println("Your request is "+emp);
return " Hi ";
}
through POSTMAN but it gives me error as,
{
"timestamp": 1511946868300,
"status": 403,
"error": "Forbidden",
"message": "Invalid CSRF Token 'null' was found on the request parameter '_csrf' or header 'X-CSRF-TOKEN'.",
"path": "/test"
}
Please anyone help me to come out of it.
I had same issue and below trick works for me.
Set http.csrf().disable() inside configure method of your DefaultWebSecurityConfig Class.
Please refer https://docs.jboss.org/jbpm/release/7.12.0.Final/jbpm-docs/html_single/ [ 3.4.1.2. Configure authentication and authorization].
Hope this solution help you.

MailChimp API v3.0 Json Parse Error

When I try update store (Patch) I get an error in the response:
{
"type":"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/",
"title":"JSON Parse Error",
"status":400,
"detail":"We encountered an unspecified JSON parsing error.","instance":""
}
My Json data is:
{
"Id":"1",
"ListId":"lalalala",
"Name":"Cat1",
"Domain":"",
"Platform":"",
"EmailAddress":"a#a.a",
"CurrencyCode":"USD",
"MoneyFormat":"",
"PrimaryLocale":"",
"Timezone":"",
"Phone":"",
"Address": {
"Address1":"",
"Address2":"",
"City":"",
"Province":"",
"ProvinceCode":"",
"PostalCode":"",
"Country":"",
"CountryCode":"",
"Longitude":0,
"Latitude":0
}
}
What is wrong with it?

MailChimp API 3.0 batch request returns 400 Invalid Resource error

I've been trying to use the batch endpoint of MailChimp API (version 3.0) to subscribe new users to a list, but can't make it work.
Here is the request:
POST /3.0/batches
{
"operations": [
{
"method" : "POST",
"path" : "lists/c852ce5c86/members",
"body": "{\"email_address\":\"email#domain.tld\", \"status\":\"subscribed\"}"
}
]
}
The request seems ok cause I get a 200 response:
{
"id": "49abca6ef3",
"status": "finished",
"total_operations": 1,
"finished_operations": 1,
"errored_operations": 1,
"submitted_at": "2015-09-21T18:11:16+00:00",
"completed_at": "2015-09-21T18:11:23+00:00",
"response_body_url": "https://mailchimp-api-batch.s3.amazonaws.com/49abca6ef3-response.tar.gz?..."
}
However, as you can see, the only operation in my batch is errored.
Here is the response_body_url for this operation:
[{
"status_code":400,
"operation_id":null,
"response":"{
\"type\":\"http://kb.mailchimp.com/api/error-docs/400-invalid-resource\",
\"title\":\"Invalid Resource\",
\"status\":400,
\"detail\":\"The resource submitted could not be validated. For field-specific details, see the 'errors' array.\",
\"instance\":\"\",
\"errors\":[{
\"field\":\"\",
\"message\":\"Schema describes object, NULL found instead\"
}]
}"
}]
which is not very helpful :(
Note that if I directly hit POST lists/c852ce5c86/members with {"email_address":"email#domain.tld", "status":"subscribed"} payload, it's working properly.
That was actually a bug in the mailchimp API. After reaching them they quickly fixed it.

403 Forbidden resposnse from a GET request to http://api.espn.com/v1/sports/news/6277112

I have problem with the ESPN API:
I have an API key, and sent a query to the address http://api.espn.com/v1/sports/news/1581816?region=GB, which included my API key in the parameters.
I received 403 forbidden response: with this JSON
{
"status": "error",
"code": 403,
"message" : "Account Inactive"
}
I am looking at http://developer.espn.com/docs/headlines#using-the-api and at the last line it says that i can make a GET request to this url and it should work, but it doesn't.
How can I receive a valid response from the ESPN servers?
I just test it and it works fine. That means your key is invalid, or you are not including it. Replace below and it will work.
http://api.espn.com/v1/sports/news/1581816?region=GB&apikey=<yourKey>
--
{
timestamp: "2013-10-13T15:33:49Z",
resultsOffset: 0,
status: "success",
resultsLimit: 10,
resultsCount: 1,
headlines: [
{ ... }
]
}

Resources