I need to create a PATCH request to move an email into a different folder, using Micro Focus Robotic Process Automation application. The syntax with this application is different to normal python and I'm having trouble figuring it out.
The below works if I remove the 'head' line, 'authorization' line, and the calling of 'header' and 'authorization' in the 'response' line
But obviously it returns a code of 401 as there's no authorization.
The authorization part throws this error: 'str' object is not callable
The headers part throws this error: 'str' object has no attribute 'items
CODE STARTS HERE:
import importlib requests = importlib.import_module('requests') json = importlib.import_module('json')
url = 'https://graph.microsoft.com/v1.0/users/{{account account}}/messages/' + messageID
body = "{'subject':" + careRecordNum + "' - Thank you for your enquiry. Ref: 1046120'}"
head = "{'Content-Type': 'application/json;charset=UTF-8'}"
authorization = "{'Authorization': 'Bearer '" + accessToken + "}"
response = requests.patch(url, data=json.dumps(body), headers=head, auth=authorization)
return {'response':response}`
Figured it out: