Codeless: Network API - Ability to add header field?

Hi all,

Congrats on the release of the new codeless module - I’m really liking it so far, and see great potential for it!

I was trying some of the features and following the videos, and had a question around the Network API. While I was able to get requests working, is there any current way to specify HTTP headers in the HTTP/S block to build more complex requests? Or is this on the roadmap that would be coming in a new release?

Cheers,
Renato

Hi Renato, Thanks you!

Yes, we will be adding new Blocks for extend the Codeless ecosystem and the block (HTTP/s Headers) is one of those. The our main goal is make creation logic more easy and intuitive for users.
We notify you when the block is in

Regards, Vlad

Thanks for the update Vlad, i’ll look forward to it!

Is there any timeline on that? Days, weeks? (Just so I can plan whether or not I should decide to leave this functionality where it currently is, instead of in codeless)

Renato

Hi Renato,

It should show up on Monday when we do our next update.

Regards,
Mark

That’s fantastic, Mark.
Much appreciated!
Renato

Hello!

Was the (HTTP/s Headers) block ever added? I am trying this aspect and cannot find a block that is accepted by the UI builder for header. I tried creating the header from an “input” field on the “form data” but I get a response stating I have not provided the header … appreciate any help.

Hello @Raj_Pawar

Welcome to the community and thanks for trying out Backendless!

In order to specify HTTP headers, you can use a “Create Object” block and configure any keys as you need

Regards, Vlad

Thanks for your response Vlad. I am using the create object block and have tried various combinations such as below without the square brackets ofcourse

Property name set to [Authorization:] and the value set to [Bearer “MysecretKey”]
Property name set to [Authorization:] abd the value set to [Authorization: Bearer “MysecretKey”]

the above with no quotes and single quotes as well - In every instance I am getting the following error from Stripe. I want to integrate to api.stripe.com/v1/charges - I tried using the stripe integration plugin for this but it only sends 2 of my 5 required properties in the payload

{“code”:0,“message”:"{“error”:{“message”:“You did not provide an API key. You need to provide your API key in the Authorization header, using Bearer auth (e.g. ‘Authorization: Bearer YOUR_SECRET_KEY’). See Stripe API reference – curl for details, or we can help at https://support.stripe.com/.",“type”:“invalid_request_error”}}","errorData”:{}}

you do not need any quotes

Maybe we are talking about different blocks, do you use the “HTTP/s” block?
Is it in the CloudeCode or UIBuilder?

image

Now I am getting this error
{
“error”: {
“message”: “Invalid request (check that your POST content type is application/x-www-form-urlencoded). If you have any questions, we can help at Stripe: Help & Support”,
“type”: “invalid_request_error”
}
}

Do you have a sample of what the request should look like? Perhaps stripe documentation provides that?

Here is the java code for creating charges from stripe documentation, hope this helps?

Stripe.apiKey = “MYSECRETKEY”;

// source is obtained with Stripe.js; see Accept a payment using Stripe Elements | Stripe Documentation
Map<String, Object> params = new HashMap<>();
params.put(“amount”, 2000);
params.put(“currency”, “usd”);
params.put(“customer”, " cus_KxXXXXXXXXXXV");
params.put(“description”,“description”);
params.put(“application_fee_amoun”,20);
params.put(“destination”," acct_1KXxxXXXxXXxb")
);

Charge charge = Charge.create(params);

This is just Java code. I’d like to see a sample request in the REST format, a curl command would work.

I searched for it and could not find it. In actuality it should work the same way as the “stripe plugin” provided by backendless. Infact I used the API service “Stripe” with method “charge”. The problem I had with that was the payload only included the “amount” and “currency” parameters and ignored all the others I have in the form. so technically the charge object from the stripe plugin would work if it passed the entire payload to stripe. I hope I am making sense with above. I am not a coder and love backendless, I believe it can provide the solution I am looking for if the stripe integration is solved!

Sincerely appreciate the help!

Is this the API you need? Stripe API reference – Create a charge – curl

YES!!! :grinning:

That is the api I am using with backendless UI builder (please see path in above picture), but I get the error as mentioned above. is my UI Builder logic not correct?

Hi Raj,

Here’s a 100% working codeless logic to handle Stripe charge:

Regards,
Mark

1 Like

Thanks Mark! You probably get to hear this a lot “you da man!”. Nonetheless I must add myself to the list of folks saying that. I learned a lot from this exercise. My form is speaking with stripe, albeit I am now getting another error (one of my fileds although populated is getting sent as null) - I will keep working on that to see what the issue there might be, but the API works!!

1 Like

The codeless function in my example doesn’t check if there is a value for a property. Perhaps a condition can be added there to check if there is a value and if not, skip the property (if it is indeed optional)

Regards,
Mark