curl Examples
This topic includes some examples of how to send requests to the Oracle Construction and Engineering Lobby API using curl commands.
Before You Begin
curl is a third-party command-line tool used for interacting with and testing APIs, and is delivered with Windows 11 and many other operating systems.
To find which version of curl you have installed, open a command prompt and enter:
curl --version
For more information about curl, go to https://curl.se.
curl Options
The following table summarizes the curl options used in the examples:
Option | Description |
---|---|
-location
|
The API endpoint. |
-request
|
The type of command, which for this API can be either
GET or
POST .
|
-header
|
Content-Type: Media type of the body of the request:
Authorization:
|
-raw data
|
Identifies the json data. |
To use curl to interact with the API, enter the curl command followed by one or more curl options and a valid API endpoint.
For example:
curl --request <command> --location https://<SERVER_URL>/api/<endpoint>
Where:
-
<command>
is the REST API method of the API. For example,GET
orPOST
. -
<SERVER_URL>
is the base URL where Lobby is deployed. For example:constructionandengineering.oraclecloud.com
constructionandengineering-ea.oraclecloud.com
constructionandengineering-au2.oraclecloud.com
-
<endpoint>
is the name of a valid Oracle Construction and Engineering Lobby endpoint, excluding the API base URL. For example,user
.
API Examples
The following examples demonstrate how to use curl to access the Oracle Construction and Engineering Lobby API.
Note:
You must generate the token with a Lobby user that has the organization admin role assigned.To get a list of my organizations
curl –request GET --location 'https://constructionandengineering.oraclecloud.com/api/user/organizations'
To get a list of the applications I use
curl –request GET --location 'https://constructionandengineering.oraclecloud.com/api/user/appinstance'
To create a Lobby user using JSON data
API requests that use the
POST
method require additional data. Pass additional data to curl using the
-data-raw
option.
curl –-request POST --location 'https://constructionandengineering.oraclecloud.com/api/user' \ --header 'Content-Type: application/json' \ --header 'Authorization: <Bearer Token>' \ --data-raw '{"lobbyUser" : { "email": "poleary@majestic.com", "firstName": "P", "lastName": "Oleary", "middleName": "D", "language": "en_AU", "lobbyOrganizationId": "00005", "setPassword": "true", }, "aconexUsers":[] } }'
To create a Lobby user and Aconex user with no assigned projects using JSON data
curl –-request POST --location 'https://constructionandengineering.oraclecloud.com/api/user' \ --header 'Content-Type: application/json' \ --data-raw '{"lobbyUser" : { "email": "poleary@majestic.com", "firstName": "P", "lastName": "Oleary", "middleName": "D", "language": "en_AU", "lobbyOrganizationId": "00005", "setPassword": "true", }, "aconexUsers": [ { "appInstanceId": "8001", "aconexOrganizationId": "99990000" } ] }'
To create a Lobby user and 2 Aconex users with no assigned projects using JSON data
curl –-request POST --location 'https://constructionandengineering.oraclecloud.com/api/user' \ --header 'Content-Type: application/json' \ --data-raw '{"lobbyUser" : { "email": "poleary@majestic.com", "firstName": "P", "lastName": "Oleary", "middleName": "D", "language": "en_AU", "lobbyOrganizationId": "00005", "setPassword": "true", }, "aconexUsers": [ { "appInstanceId": "8001", "aconexOrganizationId": "99990000"}, { "appInstanceId": "8004", "aconexOrganizationId": "123498575"} ] }'
To create a Lobby user and Aconex users one assigned to projects and one not using JSON data
curl –-request POST --location 'https://constructionandengineering.oraclecloud.com/api/user' \ --header 'Content-Type: application/json' \ --data-raw '{"lobbyUser" : { "email": "poleary@majestic.com", "firstName": "P", "lastName": "Oleary", "middleName": "D", "language": "en_AU", "lobbyOrganizationId": "00005", "setPassword": "true", }, "aconexUsers": { "appInstanceId": "8001" "aconexOrganizationId": "99990000", "projectIds":["34557890", "4322456","234450000"}, { "appInstanceId": "8004", "aconexOrganizationId": "123498575"} ] }'