Hi I am new to Ignition and trying to learn quickly. I am currently trying to figure out the formatting needed to post API calls with rest via script. Currently I am getting an error when I execute the script and I can’t quite figure out what I have incorrect. Below is my script being used. Followed by the error I am receiving. Any ideas on what I have incorrect?
import pprint
pp = pprint.PrettyPrinter(indent=4)
headers = {
#Request headers
'Content-Type': 'application/json',
'Ocp-Apim-Subscription-Key': 'MYSubscriptionKEY',
}
body = {
"resourceGroup": "Tugger",
"location": "B05",
"description": "Test with Python",
"requestType": "Pull",
"itemNo": "18308-TGZ-A030-21",
"containerCount": 1
}
#Get the json response from Cella
url = "https://api.cella-tech.com/RequestManagement/v1/ResourceGroup/Request", body, headers
CellaResponse = system.net.httpPost(url)
CellaJSON = system.util.jsonDecode(CellaResponse)
#print to see the response
print pp.pprint(CellaJSON)
Traceback (most recent call last):
File "input", line 21, in module
IOError: no protocol: ('https://api.cella-tech.com/RequestManagement/v1/ResourceGroup/Request', {'resourceGroup': 'Tugger', 'requestType': 'Pull', 'description': 'Test with Python', 'itemNo': '18308-TGZ-A030-21', 'location': 'B05', 'containerCount': 1}, {'Ocp-Apim-Subscription-Key': 'MYSubscriptionKEY', 'Content-Type': 'application/json'})