Forum Academy Marketplace Showcase Pricing Features

Problem transfering post call api from postman to bubble

hello,

i am testing an api in postman that works fine. i am exporting it using the functionality in postman. the export language is curl. i am pasting it in the bubble api connector but it does not work. is there a process to easily transfer apis from postman to bubble?

In Postman i needed to set up an environment before making it work. is there a way to make that in bubble?

This is how my api looks like in postman.



This Postman call have a pre-req, that’s mean there’s something processed in JS before the call is made. Bubble cannot do something like that directly in the API Connector.
I suspect that the pre-req create a signature for the API call but it’s hard to tell without the full script.

Do you have any link to API Doc?

1 Like

Jici, thanks a lot. you are right. i need to create a signature for the api call. i am trying to do it with toolbox plugin creating a server script but i am unable to run the command:

const SIGNATURE = CryptoJS.HmacSHA256(rawSignature, SECRET).toString();

i ahve tried also to use var crypto = require(‘crypto’)
, text = ‘I love cupcakes’
, key = ‘abcdeghi’
, hash;

var hash = crypto.createHmac(‘sha256’, key).update(text).digest(‘hex’);

var base64 = Buffer.from(hash).toString(‘base64’);

but with no sucess.

this is the api i am trying to make work: you can see the full documentation here. thanks a lot

https://developers.lalamove.com/#introduction

hI,

I have been able to obtain the token that is needed to authentica. the problem i have now is that i am not able to initialize the api. have you had previous experience initializing apis that require a time sensitive token in the authorization?

Thanks a lot!

Personnally, I mostly create a plugin to create the signature in theses case. The API Connector can be use, but the body need to fully be put in one dynamic field in body json.

but I know there’s different plugin to also authenticate with this kind of oauth. I don’t know how they use API Connector or if they do the full call inside the plugin

1 Like

Hi Jici,

Thanks a lot for your time. I managed to create the signature with a script. however i still cannot make it work. can you please confirm that the call i am making is https or is it only http?

Thanks so much!

hi Jiji,

I tried the api in another online coder and it works fine. i think there must be some problem with the way that bubble makes the call. this is the raw text of the call. the authorization is recalculated every time. we can do a little session and i can share it with your real time if that helps to identify the problem.

thanks a lot!

curl --location --request POST ‘https://rest.sandbox.lalamove.com/v2/quotations’ \

–header ‘Content-Type: application/json’ \

–header ‘Authorization: hmac 3335ab18e9f9480f706a4bc9b80a84f1:1628326074468:73179c86cdb212cd8a3af7e510ee25f4ec0b4938829992105da2c7d81c4013fb’ \

–header ‘X-LLM-market: PH_MNL’ \

–data-raw ‘{“serviceType”:“MOTORCYCLE”,“specialRequests”:[],“stops”:[{“location”:{“lat”:“14.551776”,“lng”:“121.016847”},“addresses”:{“en_PH”:{“displayString”:“Herco Center 114, Benavidez Street, Makati, 1229 Metro Manila, Philippines”,“market”:“PH_MNL”}}},{“location”:{“lat”:“14.551776”,“lng”:“121.016847”},“addresses”:{“en_PH”:{“displayString”:“Herco Center 114, Benavidez Street, Makati, 1229 Metro Manila, Philippines”,“market”:“PH_MNL”}}}],“requesterContact”:{“name”:“Ella Cortel”,“phone”:“09321234567”},“deliveries”:[{“toStop”:1,“toContact”:{“name”:“Homing Tam”,“phone”:“09321234567”},“remarks”:“Remarks for drop-off point (#1).”}]}’

Can you share what you have set in API Connector? Also, is the signature from the screenshot come from your script?

Yes, the signature comes from postman. i try it in another tool and it works. but if i try it in bubble it does not work. below you can see the raw text, the api connector and the other tool so you can compare. i literealy copy and paste the same. i do not know what else to change to make it work!

The problem is not the authorization key since i copy it directly from postman and it works in req bin. For some reason the exact same code does not work in bubble.
I have figured out already how to generate the authorization key but i first need to make the call work :slight_smile:

Thanks for your help!

curl --location --request POST ‘https://rest.sandbox.lalamove.com/v2/quotations’ \

–header ‘Content-Type: application/json’ \

–header ‘Authorization: hmac 3335ab18e9f9480f706a4bc9b80a84f1:1628384612145:aca8a8192ec63eeb888360268b06dd0ca42fb20a367ff2c9658c770f63534b28’ \

–header ‘X-LLM-market: PH_MNL’ \

–data-raw ‘{“serviceType”:“MOTORCYCLE”,“specialRequests”:[],“stops”:[{“location”:{“lat”:“14.551776”,“lng”:“121.016847”},“addresses”:{“en_PH”:{“displayString”:“Herco Center 114, Benavidez Street, Makati, 1229 Metro Manila, Philippines”,“market”:“PH_MNL”}}},{“location”:{“lat”:“14.551776”,“lng”:“121.016847”},“addresses”:{“en_PH”:{“displayString”:“Herco Center 114, Benavidez Street, Makati, 1229 Metro Manila, Philippines”,“market”:“PH_MNL”}}}],“requesterContact”:{“name”:“Ella Cortel”,“phone”:“09321234567”},“deliveries”:[{“toStop”:1,“toContact”:{“name”:“Homing Tam”,“phone”:“09321234567”},“remarks”:“Remarks for drop-off point (#1).”}]}’

Hi Jici,

I just realized that i am able to properly set up get api calls with the same server but i cannot run any post call properly. have you encountered this issue before. where do you think the problem can be?

Thanks a lot!

hi. Just solved it! used pipedream to compare both calls and realized that my issue was in the body i was sending. i corrected it and it is working fine now. thanks a lot! I will not try to get the authentication to work :slight_smile:

1 Like