What does Mandrill status = "invalid" mean in Send Message API response - api

Mandrill official documentation says that the status property in the response of Send Message API request is:
the sending status of the recipient - either "sent", "queued", "scheduled", "rejected", or "invalid"
Can't find anywhere what does invalid status indicate.
Any idea, referece ?

One reason I have found is an invalid email address. For example having two dots in a domain like this: alice#example..com

I had this happen because some of the properties in the JSON I posted had uppercase letters when the mandrill api was expecting lowercase.
I was using newtonsoft and solved it by adding JsonProperty attributes to my objects as described here: https://stackoverflow.com/a/34071205

Related

qualtrics contacts api extRef

I am using the Qualtrics API to create contacts in a mailing list. In making a call to https://ca1.qualtrics.com/API/v3/mailinglists/ML_identity/contacts I am pushing a json string containing extRef. However, I keep getting the following response:
"httpStatus": "400 - Bad Request",
"error": {
"errorMessage": "Unexpected json key provided: extRef",
"errorCode": "RP_9"
},
The documentation clearly states extRef is what the field is called. What am I missing here?
The field should be externalDataRef instead of extRef (Qualtrics is inconsitent when it comes to that field). See: https://api.qualtrics.com/api-reference/reference/researchCore.json/paths/~1mailinglists~1{mailingListId}~1contacts/post
Note that the API call is specific to Research Core Contacts. XM Directory uses a different API call to add a contact.

Invalid request body error when sending json string as data to an external api using CL_HTTP_CLIENT

We are facing an issue while sending json data to an external api using CL_HTTP_CLIENT.
The JSON data is produced using '/ui2/cl_json=>serialize( data = ls_body compress = abap_true pretty_name = /ui2/cl_json=>pretty_mode-camel_case )' .
when sending this JSON as data the the external api returns status 400 with response as
{ "errorCode": "INVALID_REQUEST_BODY", "message": "The request body is missing or improperly formatted. Unexpected character encountered while parsing value: \u001f. Path '', line 0, position 0." } .
we also stringyfied this JSON Data in backend as it might be due to parsing error but it didnt work.
The same stringyfied data tried to send through browser console using ajax and it did worked without any issue.
could any any one tell us how to handle this json object and send this to external api using CL_HTTP_CLIENT.
Note : JSON STRING is deeply nested .
Thanks in advance..
You can use request catcher service for getting SAP output.
Then check your output has valid json.
Check external api with rest tool like postman or SoapUI. Every developer not track guidliness may be external api has limitations.
The issue was with the unicodes in the string.
these were not accepted by the external api so removed from the string and sent to api and it did worked.
Thanks for You suggestion.

set error http status in response payload in mule 4

my requirement is to sent the error http status and error message in the body.
In Case of error in flow i need to pass the http code in the status field.
I can configure this http listner but don't know how to set this to get into payload. Please guide on that.
I'm expecting the MEL to get the 400 Bad Request
{
'status': "400 Bad Request",
'message': error.description
}
I could think of 2 ways of doing this:
1.You can use RAML and for every status code you can send appropriate responses as per your use case.This I think is the best way of doing it.
2.You can have the value for status and message key of your response body inside error handling block.Configure the 'TYPE' condition of your error handling block to catch a certain HTTP error message , then inside that you can set 2 vars: one with the status value and other with message value.Then use this vars in the Error response section of HTTP listener. You'll be ending up with many such error handling blocks if you want to address multiple status codes.
Let me know if you need further clarifications.Hope it helps.

Laravel 5.7 Handle email verification errors from API

I'm using laravel 5.7 to build an API REST.
When I add the verified middleware to my route group and I try to login with an unverified user by my client api, I get the error 400 Bad request. This error is too generic and don't show the problem clearly for my customer (it's happens in a login form).
If I to edit the render() method in Handler.php to ignore the isApiCall() and return parent::render($request, $e);, so I get the full error (Your email address is not verified, status 403), but when I try to return this in a json object with response()->json([$e]), the response is always empty.
So how to handle properly the api errors to be return the full message from exception, in this case?
You probably have already solved this problem, but this solution might help someone else:
The reason why your response was returning an empty array is because you were passing an Exception type object into the json function that is expecting an array. The response should look like this:
return response()->json(['message' => $e->getMessage()]);
This will return a json response like:
{
"message": "Your email address is not verified"
}

Always getting 0 rules when querying products/(id)/rules/count and 204 status from /rules

I'm contacting the API of my client's store on BigCommerce. I've verified the option set has a bunch of rules associated with it (8 product rules).
When I contact the api with
/api/v2/products/181/rules I get a 204 response.
This seems to be an incorrect response.
I tried then contacting
/api/v2/products/181/rules/count
and I get a response of:
{ count:0 }
How do I get a proper representation of these rules, as the API specification describes?
Thanks for any help you can provide. I'm stuck.
The response indicates that there are no rules associated with the product ID in your request. Are you sure that the option set you're referring to has been assigned to the product ID referenced in your request? It is possible that the option set has rules but the product does not have an option set assigned to it.