I have created a call to an external REST API. The API requires a Header Authorization to access the external data. I first tested the API param format using Postman. Testing with Postman reported that the API also required a Username/Password to work successfully.
When I tried to mimic the Postman setup within my Backendless app API, it reports “Error 401 Uncaught (in promise) p: Not existing user token [object object]”. I have tried using the same external credentials as in Postman, but have not been able to get past this error. Should I be using the credentials of the external service or credentials from Backendless?
app id = DEC6B808-645B-7B62-FF97-8D7C3B617700
page = acct-sendach
API Service/method = ForteNet / getCustomers
Hi @Richard_Munger
Most likely you connect an object as the header value that’s why it was converted to string as [object object]
the header can look like (if it requires Basic Authentication)
Authorization: Basic bXlVc2VyOm15UGFzcw==
where Authorization
is the header key and Basic bXlVc2VyOm15UGFzcw==
is the value, represents converting user/pass into base64 string Basic Base64(username:password)
I went into the API Services to adjust the URI for the service but the service is displaying “Default Deployment Model” rather than the URI I had previously defined. How do I alter the model or restore the previous functionality?
The “Endpoint URI” and a “deployment model” are separate entities. They do not overlap or cross over in any way, shape, or form. Please add screenshots so we can see what you’re talking about.
Use the “changelog” button to access previous iterations of your Cloud Code logic:
When I went to adjust the service URI using the gear icon, I noticed “model” for each defined service and after clicking on the gear, I get the following:
To adjust the endpoint URI, you need to click the “edit method” icon:
In the popup that shows up, you need to use the following section to modify the endpoint URI:
What I do not understand though, is how the endpoint URI related to what my colleague wrote in response to your original post.
Sorry, my typo. I need to adjust the URL, starting with “https://”
Adjust the URL for the API service running in Backendless? or the URL for the external REST API you use?
If it is the former, it already supports https://, no adjustment is needed.
for the latter…the REST API
That must be modified in the Codeless logic.
Agreed, when testing Codeless logic, the URL would be defined to the HTTP/s codeless function.
BUT if I want to test the REST API call from the Backendless environment using the INVOKE button,
and I need to modify the full URL, where has this information been moved to? A few days ago, the URL displayed on the gear Icon screen. Today, it displays “model”.
I
Suppose you were creating a REST API service and wanted test it with the INVOKE button before writing your Codeless logic, how would you define and modify the URL?
Using the INVOKE button before you write your Codeless logic does absolutely nothing. You invoke an empty service, what exactly are you “testing” by doing so?
1-2 weeks ago, I was able to test my API using INVOKE to ensure I had URL, URI, headers, parameters correct before proceeding with code logic. So, now there is no longer a need for the INVOKE button. You are telling me that all testing has been moved to the code logic.
If you need to test an invocation of an external service, the INVOKE button cannot do it by itself. The invoke button works ONLY with the services hosted in Backendless. If your service runs elsewhere and you need to see how that service works when you call it, you can use tools that let you do those invocations (for example Postman).
If your service has Codeless logic that invokes an external REST API. Then you call your service with the INVOKE button and the service will invoke the REST API. In that case, the URL of the REST API service will be in the Codeless logic (unless you pass it as an argument).