Smart API tutorial
In this manual you will find instructions on how to get a list of projects for a specific user.
Registration in SMART
The links below will guide you through the registration procedure in SMART UI:
Save a project
Place the project you need in My projects folder (Sales&CRM section) in order to have an opportunity to receive it via API
-
In Project database - All projects section choose the project you need. Set Status ‘Monitoring’ to the selected project.
-
After the project status is changed to Monitoring, it is automatically added to My projects - Monitoring status of the Sales & CRM section.
Authorization on Swagger UI
At this step you get the access key (“opid”) for request authorization. Authorization type - Bearer.
-
In Servers section choose the server of your country. Pay attention, which server you have the access to – staging or production, as Client ID and Client Secret are unique for each server.
-
Сlick “Try it out” in Auth section.
-
In Client authorization data field paste your API Client ID and API Secret. Then click “Execute”.
-
In the response body of Responses section, copy the result “opid”. Next, go to Authorize section and paste“opid” in the Value field, and then click Authorize button.
How to find a user ID.
In this section you will find out users' IDs of your organisation, which will allow you to get your saved project(s)
-
In Misc section click “get /client/users/”
-
Click “Try it out”, then in the fields “offset” and “limit”, set the values you need and then click “Execute”
When making requests, you will need to specify the limit and offset parameters. With these parameters you can implement the paginated output.
-
The limit parameter determines the number of elements that will be returned in the request.
-
The offset parameter determines the number of elements to skip.
The limit has a maximum value of 300, but you can iterate over the pagination up to 20,000
-
-
You can see users' IDs of your company, which will be displayed in the response body of Responses section.
Get projects request
To get a project with a particular status, you need to find out the status identifier (user_project_status_id). You can find a list of all available identifiers in the Appendix section (Appendix (Lookups, Enums, Field Descriptions)) in Swagger UI header.
-
In “Organization CRM” section click “get /client/project”, then click “Try it out”. In the fields “offset” and “limit” set the values you need.
-
In “fields” section (Fields to get in response), click “Add item” in the field provided, type as many fields as you need, separate them by comma. In our example we’ll be using “id” and “title”.
-
In “filter” section (Fields to filter), click “Add item”. In the provided field, enter filters by user and project status separated by comma:user_id:in:[20], user_project_status_id:in:[3], where [20] is your user ID (see 3.3), [3] is ID of the Monitoring folder, which is located in the Appendix under the Enum List (UserProjectSatuses), then click “Execute”.
-
The project which you added to My projects earlier will be displayed in response body of Response section.