Backendless Version Online
Application ID: F5376898-F067-441E-9263-EFE187DBB4FF
I want to pass data from backendless database tables and Files storage to a 3rd party API to process and format the data. The 3rd party requires a POST request with an authentication header. I thought this would be done through the Business Logic workflow but I don’t see how to use a 3rd party HTTPS address here. Thanks in advance for helping a novice.
Hi @shaun_brown ,
what language do you use in Business Logic?
I am just starting but I have the code example for the 3rd party in javascript
I can recommend you to use Backendless.Request , this is a part of JS-SDK
Backendless.Request.post('https://app.useanvil.com/api/v1/fill/{pdfTemplateID}.pdf', [...here is your request data])
.set('x-header-key', 'x-header-value')
.set({ 'y-header-key': 'y-header-value', 'z-header-key': 'z-header-value' })
you can find more info on how to use Backendless.Request here https://github.com/Backendless/Request
Regards,
Stanislaw
Is it possible to do this codeless as well? When I try a POST request from the HTTPS I can see the Backendless.Request code but I am a bit unsure of how to proceed. I added the authorization header but when I invoke the method the external HTTPS address is appended to a Backendless address. Is this correct. Sorry again for the newbie questions. I continue to work through the documentation.
Hello @shaun_brown
Could you please share your Codeless Logic?
Here is a screenshot. Once the method is deployed and invoked the cURL starts "curl -X “POST” “https://eu-api.backendless.com/…” I would have expected it to start with the HTTPS address listed in the method.
Thank you for sharing!
Let me ask you a few questions to get more understanding about your problem:
-
what do you mean the cURL starts "curl -X “POST” “https://eu-api.backendless.com/…”
? Is this curl is pointing to the API Service method?
-
Are you sure the request body is configured correctly? I can see that you send an object with only one property propName
where value is a string
Regards, Vlad
- Yes pointing to the API service method.
- The payload is a single JSON to fill out fields in a PDF file.
It seems to be working now. I added a content-type to the header and it seems to work.
I have some very simple codeless logic that sends a POST request with JSON data to an external service. The return payload should be a completed PDF document.
The image of my current logic communicates with the external service and returns what I assume is a PDF file:
I assume that I can attach a separate piece of logic to the “return” component of the API service and this will allow me to store the file and later access by my frontend but I am a bit unclear on how to do this.
Thanks for all the assistance.