Skip to content
Developerhome
Sage Distribution and Manufacturing Operations

Mutation: Asynchronous

  Less than to read

A GraphQL API must be executed in less than 28 seconds. Otherwise, the operation times out.

To make sure an operation can last for more time than the time-out limit, you can use an asynchronous mutation.

An asynchronous operation uses a start call and returns a tracking Id.

The following table displays an example and the result of an asynchronous mutation. Some of the fields displayed are not mandatory and others have been omitted.

mutation { 
    xtremReporting { 
        report { 
            generateReportPdf { 
                start (
                    reportName: "salesOrderQuote", 
                    reportSettings: { 
                        variables: "{\"orderNumber\":\"SO230474\"}", 
                        locale: "en-US", 
                        paperFormat: null 
                    } 
                ) 
                { 
                    trackingId 
                } 
            } 
        } 
    }
}
{ 
    "data": { 
        "xtremReporting": { 
            "report": { 
                "generateReportPdf": { 
                    "start": { 
                        "trackingId": "zCM6T7qDNdav2ZR8S0hg7" 
                    } 
                } 
            } 
        } 
    }, 
    "extensions": { 
        "diagnoses": [] 
    } 
}

You can do a second call to check the result using the returned tracking Id.

The following table displays an example of a query mutation using an asynchronous mutation and its result once it is finished. Some of the fields displayed are not mandatory and others have been omitted.

query { 
    xtremReporting { 
        report { 
            generateReportPdf { 
                track (trackingId: "zCM6T7qDNdav2ZR8S0hg7") { 
                    status result { 
                        key 
                        filename 
                        mimeType 
                        contentLength 
                        status 
                        rejectReason 
                        downloadUrl 
                    } 
                    errorMessage 
                } 
            } 
        } 
    } 
}
{ 
    "data": { 
        "xtremReporting": { 
            "report": { 
                "generateReportPdf": { 
                    "track": { 
                        "status": "success", 
                        "result": { 
                            "key": "print-output/sales-order-quote-2023-11-17-15-21-20.pdf", 
                            "filename": "sales-order-quote-2023-11-17-15-21-20.pdf", 
                            "mimeType": 
                            "application/pdf", 
                            "contentLength": 4567, 
                            "status": "verified", 
                            "rejectReason": "", 
                            "downloadUrl": "https:..."
                        }
                    }
                }
            }
        }
    }
}