Create a process
Create a process to define a data model to hold the user details and define activities to manage the user.
- Navigate to .
- Click New. The process opens in a new browser tab.
- Enter User Demo as the Name.
Add a data model
Add a data model to define the structure that will hold the user details.
- On the Data models tab, click New.
- Change the name of the model to User.
- First examine the service you will execute. In a new web browser tab, browse to https://reqres.in/
-
Scroll down to the methods and click
CREATE.
The Request and Response share some common fields (name and job). So rather than creating two models, you can create a single model.
-
Copy the following JSON:
{ "name": "morpheus", "job": "leader", "id": "16", "createdAt": "2021-05-05T11:08:27.903Z" }
-
In the
Add Data model dialog box, select
Load from external source, paste the sample JSON into the
File content box, and then click
Add. The fields are automatically added to the data model structure.
-
In addition to the fields from the sample JSON, supplement your model with additional information.
Name Type Team Text updatedAt Date - Click Add to add the model to your process.
Create variables
- Select the Variables tab and click New.
- Enter MyUser as the Name.
- Select Data object as the Type.
- Select Local Data Model and then select User as the Value.
- Click Add.
Add an activity to enter user details
Add an ordinary activity to allow you to enter details of the user being created.
- Click the Design tab to return to process design.
- On the Start node, add an Ordinary activity.
- Type Enter User Details as the Name.
-
Add the following output variables to the activity and click
Done:
-
MyUser.name
-
MyUser.job
-
MyUser.Team
-
Add an activity to create user
On the Enter User Details activity, add an activity to create a user.
- Select Type. as the
- Enter Create User as the Name.
- Select REQ as the Web service.
- In the URL parameters, enter users.
- Select POST as the Verb.
- Select JSON as the Type.
- Right-click in the Request editor and select the MyUser variable.
- Select Variable as the Response type.
- Select the MyUser variable as the Value.
-
Select
Suspend job on error.
Add an activity to review information
After the user is created, add an Ordinary activity on the Create User activity to view the information, and allow to corrections to the job to be entered.
- Enter Review as the Name.
-
Add the following input variables and click
Done.
-
MyUser.name
-
MyUser.Team
-
MyUser.id
-
MyUser.createdAt
-
-
Add the following output variable and click
Done.
-
MyUser.job
-
Add an activity to update user
To use a PUT request to update the job value that is held by reqRes, add an activity on the Review activity.
The user is uniquely identified by an ID, so that value must be passed as a parameter to the service.
- Enter Update User as the Name.
- Select Type. as the
- Select REQ as the Web service.
- In the URL parameters, enter users/ and then right-click and select MyUser.id.
- Select PUT as the Verb.
- Select JSON as the Type.
- Right-click in the Request editor and select the MyUser variable.
- Select Variable as the Response type.
- Select the MyUser variable as the Value.
-
Select
Suspend job on error.
Add an activity to verify information
After the update is complete, to verify the information, add an Ordinary activity on the Update User activity.
- Enter Final Review as the Name.
-
Add the following Input variables.
-
MyUser.name
-
MyUser.Team
-
MyUser.id
-
MyUser.createdAt
-
MyUser.job
-
MyUser.updatedAt
-
- Click Done.
Add an End node
Add an End node to the Final Review activity.
Your process will look similar to the following example.
Release the process
Click Release to release the process.
Congratulations! You have successfully created your solution to use Data objects in POST, GET and PUT operations. Continue to Test your solution.