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’)

1 Like