I'm creating JSM requests through REST API with a documented procedure attached to the REST payload. These are the steps I'm using.
1. Upload the document as a temporaty attachement using:
POST /rest/servicedeskapi/servicedesk/{serviceDeskId}/attachTemporaryfile
The upload succeeds and th eresponse contains a teporaryAttachmentId
Then, I take the returned ID and assign it to the attachement field in requestFieldValues like this:
requestFileldValues[field.fieldid] = [
data.temporaryAttachements[0].temporaryAttachementId
];
2. Create the customer Request
POST /rest/servicedeskapi/request
The request itself is always created successfuly. However, intermittently the document does not appear on the newly created jira request., even though the temporary file uploaded in step 1 completed successfuly and returned a temporaryAttachementId vlaue.
I have not intentional delays the temporary upload and the request creation.
I don't know if using temporaryAttachementId directly in the attachement field inside requestFieldValues is a supported and relaible way to create a JSM request with attachement ?
Or, should I use a differant flow
I don't know if/what shall I add to handle asynchronous processing or timing/race-condition issue between attacheTempooraryFile and POST/request.
Since the REST messages does not return any error, I don't know what my be the reason that sometimes the Service Request issue is created with the attached file, and some times the request is created with no file attached.