401 unauthorized error while creating object in back4app via Temboo - parse-server

I am creating an object in parse (using back4app parse server for this).
I get the following error when I run the choreo in temboo.
A HTTP Error has occurred: The remote server responded with a status
code of 401. Typically this indicates that an authorization error
occurred while attempting to access the remote resource. The data
returned from the remote server was: {"error":"unauthorized"} . The
error occurred in the HTTPSend (Parse) step.

That 401 error might indicate that the Id or Keys are not correct. Maybe it could be a good idea to double check them.
Also, what is the host and path for the API Request that you're doing with Temboo (I'm not acquainted with it)? If you're not using the correct ones it might cause problems too.
Make sure you're reaching something like this:
https://parseapi.back4app.com/classes/Your_Class_Name

Related

Which is a correct HTTP status code for "Error creating resource"?

I'm developing an application with authentication, and i need to provide a appropriate status code if there is any error when registering an user, for example a database-related error.
I've been researching but i haven't found an appropriate status code.
The purpose of all HTTP errors is to communicate the operation failed. To pick the right HTTP error, you need to know why it failed.
"database-related error" sounds like a server-side bug or problem, so this is likely just a 500.

REST API How to generate a 500 Error status when using a Postman Request

I need to test the 500 'internal server error' but Need to test this new API with calls from postman. Does anyone know how to make a call that will trigger it? I'm not talking about setting up a mock or doing it from the dev side. I need to invoke 500 responses by making requests so I can verify that a 500 request is returned from this new server.
The 500 Internal Server Error is internal to your system and you will get it when there is some issue in your code.
If the code doesn't has issues and you just want to get a 500 error status for testing then you can throw an exception like NullPointerException from your code.
the 500 error can be get by not passing necessary parameter in header eg x-api-key and also incorrect data in request as not accepted by server eg name an be Name

How to show the internal server errors to the user?

I am working in an API . I want to throw detailed error messages to the user. Now i am in a situation to decide what kind of error code should be sent or how to explain user if any error occurs in the application internally. For example if database connection fails , what kind of http status code i want to send to the user ?
Can anyone help ?
An HTTP status code generally refers to the status of the HTTP request itself, not the status of the application handling the request. Therefore, most server-side errors are covered by 500 Internal Server Error. Any additional info about the error should be described in the response body. For APIs, the response body will often be JSON or XML, so you can use those formats for your errors. Something like this:
HTTP/1.1 500 Internal Server Error
[headers]
{"status":"error", "message":"The request failed due to database connectivity."}
There are, however, two cases I can think of when you might want another status code. If the user has requested an API method that is not implemented, you might want a 501 Not Implemented, and when there is a temporary service outage, you can use 503 Service Unavailable.
More info about server-side status codes here.

"Sorry, an error occurred while processing this request" instagram api python-instagram

I'm using python-instagram library to get access to instagram api. But when I run my app (flask rest api application), my auth method which use InstagramAPI and get_authorize_login_url method raise 500 error:
raise OAuth2AuthExchangeError("The server returned a non-200 response for URL %s %s %s" % (url, response['status'], content))
OAuth2AuthExchangeError: The server returned a non-200 response for URL https://api.instagram.com/oauth/authorize?scope=basic&redirect_uri=http%3A%2F%2Fsocialservice.test.5-soft.com%3A8515%2Finstagram%2Fauth&response_type=code&client_id=c5095d88cee14bac91a9341e6e82ff8f 500 Sorry, an error occurred while processing this request.
In my local machine it works without any problems but in the production server with different IP I've got this problem.
I would be very appreciative if someone can help to solve me this problem
Thanks in advance,
Ron
Please clarify:
In my local machine it works without any problems but in the production server with different IP I've got this problem.
How can you be performing authorization on your local machine? Instagram's API requires a public url for redirect_uri.
Next, I haven't found any evidence to verify this, but I don't believe you can specify a custom port in your callback url (you've provided http://socialservice.test.5-soft.com:8515/instagram/auth).
Last, assuming it's your callback server that is the problem, that error usually occurs when you aren't returning the correct response back to Instagram. The server needs to echo out only the value of the GET parameter code as plaintext.
If I browse to here: http://socialservice.test.5-soft.com:8515/instagram/auth?code=test I get no response, which is likely the cause of your error.

How to properly handle Axis2 generated exceptions with a REST client

I am using Axis2 v1.6.1 and Resty as a rest client. If I purposely send a malformed request that Axis2 cannot parse, for example, sending "p=0.0" where p is an Integer, then Axis2 will generate 500 HTTP Response and log an error in it's log saying something to the effect of:
[ERROR] Exception occurred while trying to invoke service method createUpdateOrganization
org.apache.axis2.AxisFault: Invalid value "0.0" for element poStart
...
This is great but I need to be able to capture this exception information in order to act upon it as part of our exception management framework.
It seems to be throwing an AxisFault exception but this is before it reaches my service so I'm not sure what I need to configure in order to get this information.
Any ideas?
I found the following article:
http://www.packtpub.com/article/handler-and-phase-in-apache-axis
Which explains exactly what I need to do. The answer is to create a custom handler for the InFaultFlow phase. :) I hope this helps somebody else!