Run a User-Defined Query Asynchronously
Use an asynchronous request to run a user-defined query as an extract job. Use this request when you need to provide parameter values at runtime. The request returns after submitting the job, allowing you to monitor the job and retrieve its output later.
-
Identify the user-defined query that you want to run.
-
If the query includes parameters, obtain the required parameter names and values.
-
Determine whether to send a callback and select the required output format.
Set
CallbackFlagtoYonly when you want the configured callback workflow agent to receive extract completion details. Configure the callback workflow agent before you send the request. For more information, see Configure a Callback Workflow Agent.Valid values for
OutputFormatareCSVandJSON. The default value isCSV. -
Submit a
POSTrequest to therunExtractendpoint.POST /fscmRestApi/scm/redwood/11.13.18.05/runExtract
Request Example
{
"UserDefinedQueryName": "PendingInvoice",
"Type": "ORA_ASYNC",
"CallbackFlag": "Y",
"OutputFormat": "JSON",
"Parameters": {
"pOrgCode": "M1",
"pWoNumber": "M1-1100"
}
}
Response Example
{
"Type": "ORA_ASYNC",
"ExecutionId": "300100679918132",
"ExtractDefinitionName": null,
"UserDefinedQueryName": "PendingInvoice",
"CallbackFlag": "Y",
"OutputFormat": "JSON",
"Parameters": {
"pOrgCode": "M1",
"pWoNumber": "M1-1100"
},
"RequestId": "92747",
"Status": "Success",
"Result": null
}
The response includes a RequestId after the extract job is submitted
successfully. Use the request ID to monitor the job and retrieve the extract output.
For more information, see Monitor Extract
Activity.