Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- USER_KEY = ""
- CLIENT_ID = ""
- ORCHESTRATOR_NAME = ""
- ACCOUNT_LOGICAL_NAME = ""
- TENANT_LOGICAL_NAME = ""
- API_URL = "https://platform.uipath.com"
- # GET UIPATH SESSION
- orch_authentication_payload = {
- "grant_type": "refresh_token",
- "client_id": CLIENT_ID,
- "refresh_token": USER_KEY
- }
- s = requests.Session()
- r = s.post("https://account.uipath.com/oauth/token", data=orch_authentication_payload)
- access_token = r.json()["access_token"]
- s.headers.update({'Authorization': f"Bearer {access_token}"})
- s.headers.update({'X-UIPATH-TenantName': f"{TENANT_LOGICAL_NAME}"})
- ADD_ITEM_URL = f"{API_URL}/{ACCOUNT_LOGICAL_NAME}/{TENANT_LOGICAL_NAME}/odata/Queues/UiPathODataSvc.AddQueueItem"
- print(ADD_ITEM_URL)
- orch_queue_payload = {
- "itemData": {
- "Priority": "High",
- "Name": "PowerShell_Queue",
- "DeferDate": "2020-04-08T06:52:37.648Z",
- "DueDate": "2020-04-08T06:52:37.648Z",
- "SpecificContent": {"Test@odata.type" : "#String",
- "Test" : "test"}
- }
- }
- response = s.post(ADD_ITEM_URL, data=orch_queue_payload)
- print(response.text)
- print(response)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement