3E Data Insights API

03 - End points for Client User

OVERVIEW

Http end points for Client user:

1. GET /edi/odata/$metadata - Retrieves Schema/Table/View information from Database

Metadata would return the schema name, all tables/columns properties and views from the Database.

Example Request

GET: [APIM URI]/edi/odata/$metadata

Example Response

 

2. GET /edi/odata/{entity} - Retrieves all records of a table from a Database

Note: If the schema(dbo) is not specified then the API would return a 500 error. Schema and Entity name are separated by _ (underscore) e.g. dbo_Activity

Example Request

GET: [APIM URI]/edi/odata/dbo_Activity

Example Response

{
    "@odata.context": "https://edi-odata-api-nprd-int.azurewebsites.net:0/edi/api/odata/$metadata#dbo.Activity",
    "value": [
        {
            "ActivityID": "641045da-cd79-4114-9d99-0105f3e35588",
            "ActivityList": "Tlst2",
            "Code": "10",
            "Description": "List2"
        }
    ]
}

 

3. GET /edi/odata/{entity}{id} - Retrieves entity from a database table by primary key of the table.

The following keys are accepted in the request body 

$filter, $orderby, $select, $top, $skip,

Example 1:

Request for filter query having Select and Order By clause

[APIM URI]/edi/odata/dbo_Activity?$filter=contains(ActivityList, 'Tlst2')&Select=ActivityID,ActivityList,Code&Orderby=Code desc

Sample Response for filter query

{
    "@odata.context": "https://edi-odata-api-nprd-int.azurewebsites.net:0/edi/api/odata/$metadata#dbo.Activity",
    "value": [
        {
            "ActivityID": "641045da-cd79-4114-9d99-0105f3e35588",
            "ActivityList": "Tlst2",
            "Code": "10",
        }
    ]
}

 

Example 2:

Request for Top and Skip query

GET: [APIM URI]/edi/odata/dbo_Activity?$Top=3&$Skip=2

Sample Response from Top and Skip query

             {
               "@odata.context": "https://edi-odata-api-nprd-int.azurewebsites.net:0/edi/api/odata/$metadata#dbo.Activity",
                    "value": [
              {
                            "ActivityID": "c9ce73a8-dfda-4cc2-8cd1-053069fc9fea",
                           "ActivityList": "cmeGA Activity L",
                           "Code": "A300",
                          "Description": "Prepare",
                         "IsBilled": 0
        }
    ]
}

Important Note to Remember While Querying Table

Entity Name in Database How to Construct Entity Name in DI Query Comments
[dbo].[recei.pt] dbo_receipt If entity name has period, then drop the period in the table name while querying.

[dbo].[receipt]

dbo_receipt2 If duplicate entity name exists, then add suffix 2 to the table name while querying.

[dbo].[inv-oice]

dbo_invoice If entity name has hyphen, then drop the hyphen to the table name while querying.
[dbo].[recei pt] dbo_recei_pt If entity name has blankspace ,then replace it with _(underscore) while querying.
[dbo].[recei_pt] dbo_recei_pt2 If entity name already has _ underscore, then suffix 2 to the table name while querying.

 

Last Updated: Aug 03,2021