Exercise 5 | Running a Job Asynchronously |
Data | None |
Overall Goal | To run a job asynchronously using the FME REST API |
Demonstrates | How to use the submit call |
This exercise demonstrates the submit call, which is used to run a job asynchronously on the FME Server. To find more information on the Submit call visit your FME REST API page and look for the transformations section or visit the Rest API Transformations documentation.
If you run a job asynchronously you do not have to wait for the job to be completed before making the next call. By running the job asynchronously you will receive an ID back from the FME Server. You may use this ID to call the FME Server again to get a status update on the call.
We will run the exact same call, but instead of Transact, we will change the URL to Submit. By, submitting you will submit the job for processing.
1) Paste the URL below into Postman
Click the plus sign to open a new tab in Postman. Copy the URL below and paste it into Postman.
POST | http://<yourServerHost>/fmerest/v3/transformations/submit/Samples/austinDownload.fmw |
---|
2) Enter in the Headers
Fill in the Headers in Postman:
Content-Type: application/json
Accept: application/json
Authorization: fmetoken token= <yourTOKEN>
To enter in the token we can use the preset created previously. In the key-value, type the word token and the preset created will appear.
To enter in the headers required for this call. Click on the Headers tag as demonstrated below.
3) Enter in the Body
Next, we need to enter the body of the call. Click on the body section of the call and click on the raw button and paste in the body provided. In Postman you will need to use the keyboard shortcuts to copy and paste.
Body:
{
"publishedParameters": [
{
"name": "MAXY",
"value": "42"
},
{
"name": "THEMES",
"value": [
"airports",
"cenart"
]
}
]
}
Click Send
4) Review the Response
The response from the call should be:
Please note that you may receive a different number back from the FME Server. This is okay, it is just the job ID.
5) Find the Job in your FME Server
Open your FME Server, then click on the left-hand menu of the Server where it says Jobs. Click the Job ID that matches the number you received from the FME Server. Note that the translation might still be running, even though you already received a response. This is because this job is running asynchronously. Click the Job ID to see its full status.
Then, find the Log. If you scroll to almost the bottom of the page, you can see a summary of the features written.
Here, you can investigate if the job was successfully completed and what parameters were used. Here, we can see the correct features were written.
CONGRATULATIONS |
By completing this exercise you have learned how to:
|