Quick start¶
Get the API key¶
Contact with the Lifecycle Twin support to retrieve the CLIENT_ID and CLIENT_SECRET. These to key are required for the authentication via API
Authenticate¶
Before making any calls to the Lifecycle Twin API need to authenticate and retrieve the access_token
Request¶
POST /api/token HTTP/1.1
Host: eu-ecodomus-services.siemens.com
Content-Type: application/x-www-form-urlencoded
client_id=your_id&client_secret=your_secret&username=username&password=pwd&grant_type=password
Response¶
{
"access_token": "PELPIm2Mn1-JzbZRqrUxa.............ICGvNGR-Y",
"token_type": "bearer",
"expires_in": 604799,
"refresh_token": "2a66b5d105e141d.....2b80a8b7b35ea5bc91",
"user_sid": "8b6c047f-0000-0000-0000-1ceb7331eaf7"
}
For the further calls you need to use access_token
See the Authentication page for details.
curl -X POST \
https://eu-ecodomus-services.siemens.com/api/token \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'client_id=[CLIENT_ID]&client_secret=[CLIENT_SECRET]&grant_type=password&username=[LOGIN]&password=[PASSWORD]'
Fetch the data¶
Lifecycle Twin API offers methods to receive a list of objects of a particular type, and methods for receiving a particular object of the specified type using object’s unique ID.
The following headers are required within HttpHeader:
Select – this header contains a list of fields that need to be populated
{"Id", "Name", "CustomFields" : {"Id", "Value"}}
This request will return an entity or a list of entities which will have fields Id, Name, and a list of custom fields – CustomFields, where each field from CustomFields will have fields Id, Value populated.
Note
Currently the API does not guarantee populating ONLY those fields which are specified in the header. In some cases, other fields will be also populated. But the fields specified in the header will be populated.
Filter – contains filter description. This filter will be used to receive a list of objects of a particular type. It is used only in the request for a list of objects.
{"Contains" : {"Name" : "100W - 277V"}}
A request with this Select header will return objects where Name field contains a value “100W – 277V”. A list of fields available for filtering is defined by the object schema. Sample
{"equals":{"CustomFields[4be891a7-58c8-4f14-8b5b-e878fe3016f3].Value":3}}
A request with this Select header will return objects where field Value contains a value “3” for CustomField with identifier equal to 4be891a7-58c8-4f14-8b5b-e878fe3016f3
.