The Graph API has some endpoints that can have two kinds of results:
- 200 OK: This means the operation was a success
- 202 Accepted: This means the operation might take longer and has been queued. An operation id is also returned
This would be fine for me, but it does not work reliable.
For example the Graph call addCopyFromContentTypeHub usually returns a 202 with a long running operation.
If I wait some minutes and ask for the status of the long running operation, I get the following result:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites('ID_OF_SITE')/lists('ID_OF_LIST')/operations",
"value": [
{
"id": "contentTypeCopy,0x0101001AF22C0432D2D645A5EA49924FA1A96513",
"createdDateTime": "2023-06-28T16:46:26Z",
"status": "notStarted",
"type": "contentTypeCopy"
},
{
"id": "contentTypeCopy,0x0120D520000855E665A48423438E776D3C0AE3A2E7",
"createdDateTime": "2023-06-28T16:53:15Z",
"status": "notStarted",
"type": "contentTypeCopy"
}
]
}
The operation has not been started.
The docs state, that long running operations can take up to 70 minutes to finish, but I wait for some of those operations forever.
Even after the 70 minutes have passed, the status is still "notStarted".
Is this a known behaviour?
From what does it depend whether I receive a 200 or 204 if I call the addCopyFromContentTypeHub endpoint?
I do not encounter this often, but I encounter it often enough to be frustrated and the apps I provide to our users do not work reliable.