Python Script on component with REST Api?

Hi Guys,

I’ve been struggeling with finding a suitable library to use to get information from a REST Api. Does anyone have an example to share?

best regards,
Anton

Hi Anton

Have you found anything about REST Api?

BR
-Patrick

Did anyone find anything on REST within VS?
Would greatly appreciate the help.

Maybe I have a solution for you. The goal was to get/post data from/to a REST API which is running on an other system.
Therefore, I add following libraries to Visual Compents lib path:
request, certifi, chardet, idna, urllib3

After that, I could execute a get/post from/to REST API:
try:
post(purl,
{
“barcode”: barcode,
“sku”: sku,
“currentStation”: currentStation,
“destinationBridge”: destinationBridge,
“weight”: weight,
“description”: description,
“sequenceNumber”: sequenceNumber,
“transmissionDate”: transmissionDate
},
timeout=5.0
)
except ConnectionError:
raise ConnectionError(‘No connection to host’)

2 Likes

Hello patste,

I once again gave this a try but was not successful. Does it work properly for you?

Best,
Anton

Have you try Redis? Install Redis server on Windows(Old version, but still useful) or Linux, VC and your own application as clients, exchange simple messages or use json via Redis server.

Hi Anton,

in my case yes, where are you stuck?

BR
Patrick