- $input = @"
- {
- "worklog": {
- "request": {
- "id": "$RequestID"
- },
- "total_time_spent": "300000",
- "technician": {
- "name": "TECH NAME"
- },
-
- }
- }
- "@
- $header = @{TECHNICIAN_KEY=$ApiKey}
- $params = @{input_data=$input;format='json'}
- $Uri = $SdpUri + "/api/v3/worklog"
- $result = Invoke-RestMethod -Method POST -Uri $Uri -Headers $header -Body $params -ContentType "application/x-www-form-urlencoded"
Invoking REST Method with this code outputs error:
{"response_status":{"status_code":4000,"messages":[{"status_code":4001,"field":"format","type":"failed","message":"Unknown error occurred while processing your request."}],"status":"failed"}}
Now obviously, that is an extremely vague error response that doesn't allow any sort of troubleshooting other than cobbling random code changes together to see if something maybe works. This isn't a solution though.
Since the code has been working up until now, it is obviously an issue with the API itself. If not, then the API was changed without proper documentation. The documentation located both inside of MESD and in the Beta documentation both show that the above method is the proper way to construct an Add WorkLog.