FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
06-15-2021 10:59 AM - last edited on 06-15-2021 12:02 PM by CodeShepherd
i'm kinda new to JSON. i already checked: https://developer.community.boschrexroth.com/t5/ctrlX-AUTOMATION-Community/Using-REST-API-of-ctrlX-C... but here is not what I am looking for.
I have a database that needs to send a variable to the CORE every time something is scanned. The database can send this information to the CORE in JSON code.
In postman I get it working because there is a specific box there to send the bearer token with. I assume the bearer token should be sent along with every request in the header.
How can I send the bearer token with every PUT request? I am looking for the specific piece of code which allows me to send an bearer token to the CORE every time i make a request.
Solved! Go to Solution.
06-15-2021 11:35 AM - edited 06-15-2021 12:01 PM
I am not sure how your database (which one is it?) sends it requests and which programming language is used but in an standard https request just add the "Authorization" including the bearer token to your header e.g. like you can see in the topic you mentioned with YARC as an example client:
06-16-2021 01:59 PM - edited 06-16-2021 02:11 PM
what does that look like if I wanted to send that in for example from Visual Studio. the tutorial says I should send it in a "request header".
the database i mentioned is our own database. the database communicates in JSON among other things.
A piece of code needs to be created that updates a variable each time. Only the piece of code to send the Bearer token with each request is not working for me.
Could the code look like this after logging in ? :
{
"type": "int32",
"value": 10000
}
06-16-2021 02:40 PM - edited 06-16-2021 03:39 PM
The bearer token must not be part of the payload of the request but part of the header of an https request.
This is how it works in NodeJs.
var newMsg = {};
newMsg.headers = {};
newMsg.headers['authorization'] = global.get("authorization");
newMsg.payload =
{"type":"bool8", "value": msg.payload};
newMsg.url = "https://" + global.get("IP") + "/automation/api/v1.0/plc/app/Application/sym/GVL/start";
return newMsg;
So I cannot tell how it looks like for your database without more information about it. Please contact me directly with some contact data of your side so we could have a call/meeting.
06-17-2021 11:11 AM
Thanks for the offer! ill come back at you for a possible meeting. We will try a couple of things ourself first.
06-29-2021 08:21 AM
Any news from your side?
07-01-2021 08:01 AM
Last 1.5 weeks I had vacation so there have not been many follow-up steps. I will give an update soon.
07-02-2021 04:19 PM
upcoming week there will be some tests. If we are not successful after next week, I will gladly take up the offer to schedule a meeting/call.
07-16-2021 08:21 AM
Hi AndroidzZ,
did you figure out how to set the bearer header for the REST client you are using?
Would you share your result?
Regards
07-16-2021 09:06 AM
No improvements yet. We would like to schedule a meeting/call for some help if possible
07-23-2021 07:49 PM
Thank, I also have the same problem
08-02-2021 12:09 PM
Sorry for the delay. I will get in contact with you directly.
10-18-2022 03:44 PM