REST - Example of read call
FollowIn this example, let's say we want to display a list of vacancies
Let's start by creating the view or actually copying the Vacancies list system view. Then:
Now create a token with the above mentioned method:
- Create a user. This is the user the Token will use to access the platform
- Assignpermissions to the user. Assign only the permissions for Vacancies reading
- Createan API token for your user
You can also use an existing user: the permissions in that case will be those already assigned to the selected user. Therefore, if you choose an Administrator user, the Token will give the application access to all the data of the platform.
REST v2 - Read
For example, if the URL of the REST API is
- https://platform.altamirahrm.com/api/v2 /REST/VIEW_TAGNAME
Then the URL to invoke the Job.List.API method is:
- https://platform.altamirahrm.com/api/v2 /REST/Jobs.List.API
Type |
Name |
Description |
Schema |
header |
Token (required) |
Token generated by Authentication |
string |
Put the Token in the HTTP header.
You can already invoke the URL and see the output that will be structured like this:
{
"Jobs.List.API": [
{
"Jobs.FullName": "Acme Inc - 0002 - Junior Sales Account",
"Jobs.State": "/ Not yet published /",
"Jobs.DatePublished": "0001-01-01T00: 00: 00.000Z",
"Jobs.DateToUnpublish": "0001-01-01T00: 00: 00.000Z",
"Jobs.ReceptionType": "/ Back office /"
},
{
"Jobs.FullName": "XYZ Inc - 0003 - Senior software developer",
"Jobs.State": "/ Currently published /",
"Jobs.DatePublished": "2019-08-17T16: 53: 24.590Z",
"Jobs.DateToUnpublish": "0001-01-01T00: 00: 00.000Z",
"Jobs.ReceptionType": "/ Back office /"
},
{
"Jobs.FullName": "XYZ Inc - 0005 - Accounting specialist",
"Jobs.State": "/ Currently published /",
"Jobs.DatePublished": "2019-04-04T18: 14: 33.607Z",
"Jobs.DateToUnpublish": "0001-01-01T00: 00: 00.000Z",
"Jobs.ReceptionType": "/ Back office /"
}
]
}
The call then returns the list of vacancies in the platform in a JSON array. Each element of the array contains the tag names of the fields included in the view as properties.
Rest v1 - Read
Now you can build the URL to access the API:
- From the user settings copy the REST API URL
- Replace the YOUR_APIKEY markers with the API key you generated and VIEW_TAGNAME with the name tag Jobs.List.API
For example, if the URL of the REST API is
- https://platform.altamirahrm.com/api/v1/altamira/REST/VIEW_TAGNAME?ApiKey=YOUR_APIKEY
then the URL to invoke the Job.List.API method is:
- https://platform.altamirahrm.com/api/v1/altamira/REST/Jobs.List.API?ApiKey=0123456789012345
Obviously the API key is just an example. To enhance security, you can put the API key in the HTTP header instead of the URL. The header name is ApiKey.
You can already invoke the URL and see the output that will be structured like this:
{
"Jobs.List.API": [
{
"Jobs.FullName": "Acme Inc - 0002 - Junior Sales Account",
"Jobs.State": "/ Not yet published /",
"Jobs.DatePublished": "0001-01-01T00: 00: 00.000Z",
"Jobs.DateToUnpublish": "0001-01-01T00: 00: 00.000Z",
"Jobs.ReceptionType": "/ Back office /"
},
{
"Jobs.FullName": "XYZ Inc - 0003 - Senior software developer",
"Jobs.State": "/ Currently published /",
"Jobs.DatePublished": "2019-08-17T16: 53: 24.590Z",
"Jobs.DateToUnpublish": "0001-01-01T00: 00: 00.000Z",
"Jobs.ReceptionType": "/ Back office /"
},
{
"Jobs.FullName": "XYZ Inc - 0005 - Accounting specialist",
"Jobs.State": "/ Currently published /",
"Jobs.DatePublished": "2019-04-04T18: 14: 33.607Z",
"Jobs.DateToUnpublish": "0001-01-01T00: 00: 00.000Z",
"Jobs.ReceptionType": "/ Back office /"
}
]
}
The call then returns the list of vacancies in the platform in a JSON array. Each element of the array contains the tag names of the fields included in the view as properties.
Comments
0 comments
Please sign in to leave a comment.