HTTP Request
HTTP requests are automations that integrate one system with another.
This is a good feature to use if you want to integrate FieldPro with any external system, i.e., third-party ERP systems that have an API. Through the meta expression, you can reuse the request's result in another job.
HTTP request is a job located in the Workflow, Job section on the web app as shown below:
On the Job section, click on the create button at the top right part of the web app screen and click on HTTP request job to create
HTTP Requests are stored in the http requests table.
On the creation page, a http request object has the following attributes:
Name: Here set a friendly name that is applicable to the job
Url: Here key in the url of the API request
Method: can be either be Get, Post, Patch, Put or Delete depending on the actions you intend the job to perform
GET - Fetch
The GET method is used to retrieve data from a specified resource.
It is primarily used for reading or fetching information from a server.
Example: Retrieving information about a user's profile by sending a GET request to "/users/{userID}".
POST - Create
The POST method is used to submit and send data to be processed to a specified resource.
It is often used for creating a new resource on the server.
Example: Creating a new user by sending a POST request to "/users" with the user data in the request body.
PUT & PATCH - Editing
PUT and PATCH are used to update a resource on the server, but they differ in their approach.
PUT: Typically used to update or replace an entire resource at a specific URL.
Example: Updating a user's profile by sending a PUT request to "/users/{userID}" with the updated user data.
PATCH: Used to apply partial modifications or updates to a resource.
Example: Updating only the email address of a user by sending a PATCH request to "/users/{userID}" with the modified data.
DELETE - Delete
Which is used to request the removal of a resource
Body: the body should be in JSON format as shown below
{
"key1": "value1",
"key2": "value2",
"key3": {
"nestedKey1": "nestedValue1",
"nestedKey2": "nestedValue2"
},
"key4": ["arrayValue1", "arrayValue2"]
}
Ensure that your JSON is valid and follows the appropriate structure for your API's requirements.
Query: is the array of key value pair to add as query to the http request
Headers: an array of key value pair to add as header of the http request
Once you have filled all the necessary fields click on save to save the http request job.
Next up go to the workflow and create a workflow to run the HTTP request job that has been created as shown below
In the workflow settings, give the workflow a name to differentiate it from the ones already existing. Once done save.
Locate the workflow that you've just created, navigate to the edit icon, click to edit and add the steps; Http job, timer and start workflow as shown below
On the step, Timer, add the frequency in which you want the Http job to be executed in the relative and absolute values section, once done save changes.
On the start workflow step click on it and select the workflow name as shown and save changes.
Once done save the edited workflow and navigate to the same workflow's settings page.
Scroll to the bottom part of the workflow settings page, enable run workflow at creation and save changes in order to create the loop of the http job as shown below
You should be able to get the notification according to what was set i.e. received notifications on slack after every 24hours.
Url used in the example is altered for security reasons. But you can use HTTP request with any endpoint.
This is a good feature to use if you want to integrate FieldPro with any external system, i.e., third-party ERP systems that have an API. Through the meta expression, you can reuse the request's result in another job.
HTTP request is a job located in the Workflow, Job section on the web app as shown below:
How to configure
On the Job section, click on the create button at the top right part of the web app screen and click on HTTP request job to create
HTTP Requests are stored in the http requests table.
On the creation page, a http request object has the following attributes:
Name: Here set a friendly name that is applicable to the job
Url: Here key in the url of the API request
Method: can be either be Get, Post, Patch, Put or Delete depending on the actions you intend the job to perform
GET - Fetch
The GET method is used to retrieve data from a specified resource.
It is primarily used for reading or fetching information from a server.
Example: Retrieving information about a user's profile by sending a GET request to "/users/{userID}".
POST - Create
The POST method is used to submit and send data to be processed to a specified resource.
It is often used for creating a new resource on the server.
Example: Creating a new user by sending a POST request to "/users" with the user data in the request body.
PUT & PATCH - Editing
PUT and PATCH are used to update a resource on the server, but they differ in their approach.
PUT: Typically used to update or replace an entire resource at a specific URL.
Example: Updating a user's profile by sending a PUT request to "/users/{userID}" with the updated user data.
PATCH: Used to apply partial modifications or updates to a resource.
Example: Updating only the email address of a user by sending a PATCH request to "/users/{userID}" with the modified data.
DELETE - Delete
Which is used to request the removal of a resource
Body: the body should be in JSON format as shown below
{
"key1": "value1",
"key2": "value2",
"key3": {
"nestedKey1": "nestedValue1",
"nestedKey2": "nestedValue2"
},
"key4": ["arrayValue1", "arrayValue2"]
}
Ensure that your JSON is valid and follows the appropriate structure for your API's requirements.
Query: is the array of key value pair to add as query to the http request
Headers: an array of key value pair to add as header of the http request
Once you have filled all the necessary fields click on save to save the http request job.
Next up go to the workflow and create a workflow to run the HTTP request job that has been created as shown below
In the workflow settings, give the workflow a name to differentiate it from the ones already existing. Once done save.
Locate the workflow that you've just created, navigate to the edit icon, click to edit and add the steps; Http job, timer and start workflow as shown below
On the step, Timer, add the frequency in which you want the Http job to be executed in the relative and absolute values section, once done save changes.
On the start workflow step click on it and select the workflow name as shown and save changes.
Once done save the edited workflow and navigate to the same workflow's settings page.
Scroll to the bottom part of the workflow settings page, enable run workflow at creation and save changes in order to create the loop of the http job as shown below
You should be able to get the notification according to what was set i.e. received notifications on slack after every 24hours.
Url used in the example is altered for security reasons. But you can use HTTP request with any endpoint.
Updated on: 28/11/2024
Thank you!