MailChimp API v3.0 Json Parse Error - mailchimp

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?

Related

Aws-appSync Resolver mapping templte getting sliced data

Currently my data return from graphql query is in format and have 1200 questions from my http data source and want to return only first 10 through graphl in response mapping template.
{
"data": {
"questions":[
{
questions:"ques 1"
},
{
questions:"ques 2"
}, ....
]
}
}
My response mapping template code look likes this for slicing on aws appsycn(VTL direct resolver)
#if($ctx.result.statusCode == 200)
$ctx.result.body.data.questions.slice(0,10)
But getting error message:
Unable to convert $ctx.result.body.data.questions.slice(0,10)\n to Object"
i have tries to return via $util.toJson() also, but still facing same error.

How to fix "Syntax Error: Expected Name, found String \"query\"" in GraphQL

I'm trying to test the GraphQL server I built, by sending GraphQL queries to the server using Postman.
It works when I'm using raw radio button, but when I'm trying to use GraphQL radio button, it returns "message": "Syntax Error: Expected Name, found String \"query\"".
I have tried to change the syntax: mainly add or delete curly braces but nothing happened.
The query I sent in raw mode (working):
{
person(id:"123456789") {
personal_info {
address
}
}
}
The query I sent in GraphQL mode:
QUERY:
query getPerson ($id: String){
person(id: $id){
personal_info {
address
}
}
}
GRAPHQL VARIABLES:
{
"id": "123456789"
}
I expect to get the data I asked for, but I get the error message:
{
"errors": [
{
"message": "Syntax Error: Expected Name, found String \"query\"",
"locations": [
{
"line": 1,
"column": 2
}
]
}
]
}
I had the same problem. During researching I have found the next answer on stackoverflow, thanks #gbenga_ps.
Resolved by adding the correct header to Postman request:
Body of request should be something like next:
{
courses {
title
}
}
If incorrect content-type set, error like next happened:
{
"errors": [
{
"message": "Syntax Error: Expected Name, found String \"query\"",
"locations": [
{
"line": 1,
"column": 2
}
]
}
]
}

How to handle Exception and return proper HTTP code in Spring webflux?

I have a method which gives response using Mono.fromfuture(result) and which throws CustomException with 400 as status.
Now in my service class, when I call that method, the error and code I am throwing there is not getting propagated to my client(postman). Only the message is what I am seeing.
I am getting this below format: -
{
"timestamp": "2019-02-01T11:13:32.748+0000",
"path": "/some_url",
"status": 500,
"error": "Internal Server Error",
"message": "Unable to fetch Response"
}
Expectation (what I want to achieve) : -
{
"timestamp": "2019-02-01T11:13:32.748+0000",
"path": "/some_url",
"status": 400, // (my own status)
"error": "INVALID_ARGUMENT", // (my own error)
"message": "Unable to fetch Response"
}
My Code:-
public Mono<ResponseObject> fetchResponse(arg) {
return Mono.just(somedata which will give exception)
.flatMap(k -> callExternalService(k))
.onErrorMap(e -> Mono.error(
new BusinessException("Unable to fetch Response", e))
*/* e here is giving :-
"code" : 400,
"message" : "Request contains an invalid argument.",
"status" : "INVALID_ARGUMENT" */*
}
Have you looked at the documentation of the Response class?
You can create a Response of your own, using the static methods in the doc, and send it, instead of Mono.error, in the onErrorMap.
You have to return something like below:
ServerResponse.ok().contentType(MediaType.APPLICATION_JSON).body(klass, Klass.class);
ServerResponse.status(status).build();//read doc and set for yourself
You can also check this link.

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.

JSON PARSE ERROR 200 Unexpected token

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.

Resources