Skip to main content

Report Templates - Using API to Get Keywords

Using API to get Entity IDs and Column Descriptions (For Report Template Alignment)

Written by Roy Abery


Introduction

These instructions guide you to use Swagger / API Documentation to be able to obtain entity IDs, and from these, determine column name (fields) as aligns with the Report Template tables reported out (which does not always align with Data Requirements!)
​

To use this functionality, you will need to be an O3 System Administrator of the O3 site (deployment).

​
​Step 1 – Obtaining an API key and Accessing Swagger
​
​Menu: System Admin Navigation – Users – API User
​
Either create a user (suggest make as system admin and set as active and add the projects the API user will have access to and generate a key).
​
​OR
​
Use an existing one if applicable.
​

A screenshot of a computer

Description automatically generated, Picture


Copy the API key to authorize Swagger connection.
​
​Step 2 – Open Swagger (API Documentation)

You can access Swagger via the profile button in the top right.
From the menu, click on API Documentation to open Swagger.


In Swagger (link below), click on Authorize button and paste in the key.
​​

A screenshot of a computer

Description automatically generated, Picture


​Step 3 – If you do not know the project id, refer to example O3 project URL (not to be confused with the Project Entity ID!).
​
​Example: https://training.o3solution.com/#/projects/10/actions/execution-task-steps/list/iwps
​
so 10 in this example.
​
​Step 4 - If you do not know the entity id for the table you need to explore, use the Swagger API entry ‘Entity Types’ as below.

Click on ‘Try it Out’ and then the ‘Execute button.
​

A blue and white rectangle with a loading bar

Description automatically generated, Picture


​In the Response body, you should get results as below. Use the scroll bars to find the entity or you can copy/download the results. When you find the entry, the ID should appear in the row above. So below ID 17 represents ‘Approval’ entity.
​
​[

{

"ID": 17,

"Name": "Approval"

},

{

"ID": 48,

"Name": "Approval Type"

},

{

Determine Column Names:
​
In the above example lets say we have established ‘Project 68’ ID is 10 and the IWP entity ID is 4.
​
If we want to list out the column names, say for the execution task step table, we can open /api/work-package-execution-tasks/steps/list/{projectID}/{entityTypeID}
​
​

A screenshot of a computer

Description automatically generated, Picture

​
Click on the ‘Try It Out’ button and enter Project ID as e.g. 10 and IWP as e.g. 4 (which are both required for the API call).
​
To keep the return data concise and faster, suggest take 1 record, as we are only interested in the column names, so only one record is needed as example.
​
Now click on the ‘Execute’ blue button further down.
​

A screenshot of a computer

Description automatically generated, Picture


​Once you execute the API call, refer to the ‘Response body’ section below the ‘Execute’ button. Here you can scroll down and refer to the column names.
​

A screenshot of a computer program

Description automatically generated, Picture

​ ​
As an example of differences between the API returned columns and the Data Requirements, on the Date Requirements you may have the field listed as ‘Sort Order’, but you will need to use ‘Execution Task Sort Order’ for the report template field name.
​


Did this answer your question?