We were unable to decode the JSON response from the Mandrill API - json

I am using the standard Code from: https://mandrillapp.com/api/docs/messages.php.html, require_once 'mandrill.php'; before using it and the directory is also right. But I am getting this exception the whole time, and I dont know why
Fatal error: Uncaught exception 'Mandrill_Error' with message 'We were
unable to decode the JSON response from the Mandrill API: window.NREUM||(NREUM={}),__nr_require=function(e,n,t){function
r(t){if(!n[t]){var
o=n[t]={exports:{}};e[t][0].call(o.exports,function(n){var
o=e[t][1][n];return r(o||n)},o,o.exports)}return
n[t].exports}if("function"==typeof __nr_require)return
__nr_require;for(var o=0;op;p++)u[p].apply(s,t);return
s}function a(e,n){f[e]=c(e).concat(n)}function c(e){return
f[e]||[]}function u(){return t(n)}var
f={};return{on:a,emit:n,create:u,listeners:c,_events:f}}function
r(){return{}}var
o="nr#context",i=e("gos");n.exports=t()},{gos:"7eSDFh"}],ee:[function(e,n){n.exports=e("QJf3ax")},{}],3:[function(e,n)
in
Anyone an idea?

It is possible that you get this error when the mailservice is down or has Internal server errors (500). Embed your sending code in a try/catch block and use the catch block to fall back on another mailing service.

Related

Getting only one line i.e Configure Successfully message in postman in json but when added in json file for asserting its taking as invalid [duplicate]

We are testing API Automation with Rest Assured in Java.
In Postman, we run API after success gives message as "Record Saved Successfully"
Trying to automate the same. How to validate only message recieve as response in body.
response.then().assertThat().statusCode(200);
.and().body("$", "Record Saved Successfully");
its not working, Please help
Use built-in assertion mechanism:
response
.then()
.assertThat()
.statusCode(200)
.body("message", equalTo("Record Saved Successfully"));

Failed to fetch swagger with error message: Unexpected end of JSON input

I have a Function app, which i am calling from a logic App. When ever i am adding the Action for function app, My funciton app unable to retrive. Its showing the below error
Failed to fetch swagger with error message: Unexpected end of JSON
input. Ensure you have CORS enabled on the endpoint and are calling a
valid HTTPS endpoint
I have refereed --> Stackoverflow , but its not working.
Any help is really appreciated.
.

VM892:1 Uncaught SyntaxError: Unexpected token e in JSON at position 0

I'm presently working on a phx / phoenix API written in Elixir. And I have created a frontend for the API using React.js. However, I'm getting the below error message in the JS console of the browser.
I have successfully created a user using Postman, so I'm 99% sure the error isn't with the phx project, but rather somewhere with the React project.
I have both the frontend and backend hosted on github. And a .env file will need to be created in the root of the React project with the below line,
REACT_APP_API_URL=http://localhost:4000/api
and was working my way through the following tutorial.
Any and all help would greatly be appreciated.
The output of localStorage.getItem("token") being
eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJVc2VyOjEiLC‌​JleHAiOjE0ODcyODI4OD‌​csImlhdCI6MTQ4NDY5MD‌​g4NywiaXNzIjoiUGhvZW‌​5peENoYXQiLCJqdGkiOi‌​IwNzFlYzgwYi0wZmYzLT‌​QyYzgtODA3Mi1kNzViZm‌​VhZTg4NWEiLCJwZW0iOn‌​t9LCJzdWIiOiJVc2VyOj‌​EiLCJ0eXAiOiJhY2Nlc3‌​MifQ.NsuqH50HooK8vjF‌​fHtPH9iXSykZ9oYA0ul4‌​b_C5fQtpu_zFvNNy-skc‌​v9HI2i25X-NlB-9xOr-x‌​zh2abnrpYUw
suggests that for some reason, the app stored the token without passing it through JSON.stringify, and calling JSON.parse on this string throws the Unexpected token e error, as expected.
I did not see any localStorage.setItem without JSON.stringify in the current code, so the token was probably stored like that in a previous version of the app. You should try clearing it manually and logging in again.
When we get the non-JSON response, we get such error..
To avoid such error, mention the responseType: Text in your api endpoint call.
This will work,
return this.http.post(`${environment.apiUrl}/login`, user, {responseType: 'text'});
This will not work(If you mention type),
return this.http.post<string>(`${environment.apiUrl}/login`, user, {responseType: 'text'});
This error message usually means you're getting a non-JSON response. If you look at the raw response in the Network tab of your debugger, you should be able to see what you're getting back from the server.

Http response exceptions format

Does anyone know what is the best format to return an HTTP response error to the client when facing an exception? A format to handle the error in a dynamic way and the easiest way to catch the exception between server and client
i suggested the following, but i need to get the best format for the error response:
{
"FLAG": "ERROR",
"TEXTEN": "SERVER ERROR – BAD REQUEST"
}
One good solution would be to send back the error code in the answer's headers, using the standardized HTTP codes from the HTTP protocol.
You can also add you own error code and a corresponding human readable message in the JSON body to provide more informations on the encountered error.
For example, for a Bad Request error, the corresponding HTTP code is 400. So you should send back the HTTP code 400 in the response header and the corresponding HTTP message (Bad Request). But some programming languages does not offer out of the box features to read the message. To be sure that the user can read it properly, you can also put it in the JSON body if you want.

Why am I getting invalid XML as a response from EWS calls?

Just starting out with Exchange Web Services and getting a strange error right off the bat.
The Exception I get is "The response received from the service didn't contain valid XML."
The Inner Exception is "DTD is prohibited in this XML document."
So any ideas on what could cause that?
Turns out I was using the wrong url for the web services.