2024 TechGuide WebAPI
2024 TechGuide WebAPI
®2023 Dassault Systèmes. Apriso, 3DEXPERIENCE, the Compass logo and the 3DS logo, CATIA, SOLIDWORKS, ENOVIA, DELMIA, SIMULIA, GEOVIA, EXALEAD, 3D VIA, BIOVIA, NETVIBES, and 3DXCITE
are commercial trademarks or registered trademarks of Dassault Systèmes or its subsidiaries in the U.S. and/or other countries. All other trademarks are owned by their respective owners.
Use of any Dassault Systèmes or its subsidiaries trademarks is subject to their express written approval.
Web API | DELMIA Apriso 2024 2
Contents
1 Introduction 3
1.1 Prerequisites 3
1.2 Glossary 3
1.3 What is a RESTful API? 4
2 DELMIA Apriso Web API 5
2.1 API Key 5
2.2 Access Token 6
2.2.1 Obtaining an Access Token 6
2.3 Authorization Flows 9
2.4 Adding a Client Application 15
2.5 Example: Calling a Standard Operation 17
2.5.1 Sample Scenario 17
2.5.2 Execution Parameters 21
3 Web API Client 22
3.1 Authorization 22
3.2 Adding a Web Service Provider 23
3.3 Functions 26
3.4 Default and Custom Headers 28
3.5 Debugging 29
3.6 Example: Calling an External Web API 29
4 Documentation Availability 33
Web API | DELMIA Apriso 2024 3
1 Introduction
DELMIA Apriso exposes a RESTful API (see 1.3 What is a RESTful API?) which can be used
by a client, such as another instance of DELMIA Apriso or a different external application, to
access specific resources. For example, it is possible to publish Standard Operations to be
accessible in this manner. In this Technical Guide, this API is referred to as the DELMIA
Apriso Web API.
In addition to exposing its own web API, DELMIA Apriso is also able to call RESTful APIs made
available by other providers using the Web API Client functionality. The Web API Client is a
JavaScript API which can be used in the HTML Layout Editor's JavaScript tab in Process
Builder.
Importantly, DELMIA Apriso implicitly handles access token-based and API key-based
authorization, as well as the 3DPassport authorization framework. Access token authorization
is handled in compliance with the OAuth 2.0 Authorization Framework.
1.1 Prerequisites
Note that this guide is intended for a highly technical audience. Although it contains a thorough
overview of all the configuration steps needed to use DELMIA Apriso in either of the capacities
discussed above, the reader should already have a good understanding of the purpose of web
APIs and how to use them. Preferably, they should be familiar with the various authorization
flows typically used in the web API context, such as the access token flow (according to the
OAuth 2.0 Authorization Framework), and the API key flow. Knowledge of the HTTP
protocol, including request headers and HTTP methods (particularly GET and POST), is also
essential.
1.2 Glossary
This section provides an overview of key terms used in this document.
Base URL – the common part shared by each endpoint (see below) exposed by an API (for the
DELMIA Apriso Web API the base URL is http://{server_name}/Apriso/httpServices).
Web service provider – a party exposing a web API for use by external applications (clients).
http://{server_name}/Apriso/httpServices/operations
In this example, a GET request to the operations endpoint would return a list of all Standard
Operations published through the Web API on that particular DELMIA Apriso server. Note that
all endpoints share the same base URL: http://{server_name}/Apriso/httpServices.
For a complete list of endpoints exposed by the DELMIA Apriso Web API, see the Web API
Reference Documentation.
Web API | DELMIA Apriso 2024 5
All the credentials needed by a client application to access the DELMIA Apriso Web API,
such as the API key, client ID, and client secret, are stored in the ClientApplications.xml file
on the DELMIA Apriso server. For more information on how to register an application as a
client application, see 2.4 Adding a Client Application.
The DELMIA Apriso Web API supports two modes of authorization: API key and access
token. The details of the two authorization flows are presented in the subsections below.
The server then examines the request and validates the headers against the API key and client
ID defined in the ClientApplications.xml file:
If the server fails to validate the provided credentials, it will refuse to authorize the request (HTTP
401 Unauthorized). If authentication succeeds, the server will respond with HTTP 200 OK:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/10.0
api-supported-versions: 2
Content-Length: 25
Scopes
Scopes restrict the application's access to resources by determining which endpoints it can
access. For example, in order to call Standard Operations exposed via the DELMIA Apriso Web
API, the client application needs the standard_operations scope so that it can use the operations
endpoint (the full resource URL would be as follows: http://{server_
name}/Apriso/httpServices/operations).
The following scopes are available in DELMIA Apriso out of the box:
standard_operations
personalization
cache
data_paging
message_processing
See the Web API Documentation to learn which scope or scopes to use for specific
resources.
Scopes for which the client application can request an access token are configured in the
ClientApplications.xml file, which is discussed in extensive detail in 2.4 Adding a Client
Application.
The following sample request generates an access token valid for the standard_operations
scope:
Web API | DELMIA Apriso 2024 8
GET http://{server_name}/Apriso/Portal/sts/2.0/token?client_id=0F22E127-206E-4BE3-A1FC-
1078F65A743A&response_type=token&redirect_uri=http%3A%2F%2F{server_
name}%2FApriso%2Fmodules%2Foauth%2Foauth_callback.html&scope=standard_
operations&state=samplestring HTTP/1.1
Host: {server_name}
Accept: application/json
Authorization
The client application can obtain an access token from STS using any of the four supported
authorization flows:
Implicit Grant (temporary user authorization)
Authorization Code (refreshable user authorization)
Resource Owner Password Credentials (the user's credentials are passed in the request
body)
Client Credentials (application authorization)
For an in-depth discussion of the four authorization flows, see 2.3 Authorization Flows.
Once the access token has been obtained, the application can use it to make requests to the
API. The token should be placed in the Authorization header with the Bearer scheme:
If the server fails to validate the provided credentials, it will refuse to authorize the request (HTTP
401 Unauthorized). If authentication succeeds, the server will respond with HTTP 200 OK:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/10.0
api-supported-versions: 2
Content-Length: 32
For detailed information on these authorization flows, refer to the OAuth 2.0 Authorization
Framework.
Implicit Grant
GET http://{server_name}/Apriso/Portal/sts/2.0/token?client_id=0F22E127-206E-4BE3-A1FC-
1078F65A743A&response_type=token&redirect_uri=http%3A%2F%2F{server_
name}%2FApriso%2FApriso%2Fmodules%2Foauth%2Foauth_callback.html&scope=standard_
operations&state=somespecyficstring HTTP/1.1
Host: {server_name}
Accept: application/json
Example response:
Web API | DELMIA Apriso 2024 10
Authorization Code
GET http://{server_name}/Apriso/Portal/sts/2.0/token?client_id=0F22E127-206E-4BE3-A1FC-
1078F65A743A&response_type=code&redirect_uri=http%3A%2F%2F{server_
name}%2FApriso%2Fapriso%2Fmodules%2Foauth%2Foauth_
callback.html&scope=personalization&state=somespecificstring HTTP/1.1
Host: {server_name}
Accept: application/json
Example response:
Web API | DELMIA Apriso 2024 11
client_id=0F22E127-206E-4BE3-A1FC-1078F65A743A&client_secret=1E274C15-CC57-4DB9-A740-
BB3930FD07CE&code=5f5579b1-1e92-491c-a24f-be11ac514dff&grant_type=authorization_
code&redirect_uri=http%3A%2F%2F{server_
name}%2FApriso%2Fapriso%2Fmodules%2Foauth%2Foauth_
callback.html&state=somespecificstring
Example response:
Web API | DELMIA Apriso 2024 12
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Content-Length: 470
{"access_token":"
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6InBlcnNvbmFsaXphdGlvbiIsImNsaWVudF9pZC
I6IjBGMjJFMTI3LTIwNkUtNEJFMy1BMUZDLTEwNzhGNjVBNzQzQSIsImp0aSI6IkFETUlOIiwiZXF1aXBtZW50I
joiIiwibGljZW5zZSI6IjIiLCJpc3MiOiJBcHJpc28iLCJhdWQiOiJBcHJpc28iLCJleHAiOjE1MjY1NTU0MzUs
Im5iZiI6MTUyNjU1NDgzNX0.TS6jeoZ6NtimbzwxYat15NGGEY5ntAOOj5HoRutmito","token_
type":"Bearer","expires_in":600,"refresh_token":"4d916b97-dfc6-494c-a59b-
dbb73b057663","state":"somespecificstring"}
Refresh Token
refresh_token=4d916b97-dfc6-494c-a59b-dbb73b057663&grant_type=refresh_
token&state=somespecificstring
Example response:
Web API | DELMIA Apriso 2024 13
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Content-Length: 415
{"access_token":"
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6InBlcnNvbmFsaXphdGlvbiIsImNsaWVudF9pZC
I6IjBGMjJFMTI3LTIwNkUtNEJFMy1BMUZDLTEwNzhGNjVBNzQzQSIsImp0aSI6IkFETUlOIiwiZXF1aXBtZW50I
joiIiwibGljZW5zZSI6IjIiLCJpc3MiOiJBcHJpc28iLCJhdWQiOiJBcHJpc28iLCJleHAiOjE1MjY1NTU5OTIs
Im5iZiI6MTUyNjU1NTM5Mn0.j39LfGJGZ_x2LC6MtPkJhi3Anlj7SFsTWUzfrjoz-oM","token_
type":"Bearer","expires_in":600,"state":"somespecificstring"}
grant_type=password&login_type=standard&username={username}&password=
{password}&scope=personalization&client_id=0F22E127-206E-4BE3-A1FC-
1078F65A743A&state=somespecificstring
Response example:
Web API | DELMIA Apriso 2024 14
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Content-Length: 415
{"access_token":"
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6InBlcnNvbmFsaXphdGlvbiIsImNsaWVudF9pZC
I6IjBGMjJFMTI3LTIwNkUtNEJFMy1BMUZDLTEwNzhGNjVBNzQzQSIsImp0aSI6IkFETUlOIiwiZXF1aXBtZW50I
joiIiwibGljZW5zZSI6IiIsImlzcyI6IkFwcmlzbyIsImF1ZCI6IkFwcmlzbyIsImV4cCI6MTUyNjU2MDQyNiwi
bmJmIjoxNTI2NTU2ODI2fQ.ewABEBYD6qBz_9Qcla2Dt7OQjUtbf_bYhtNaXDPjeNE","token_
type":"Bearer","expires_in":3600,"state":"somespecificstring"}
Client Credentials
grant_type=client_credentials&client_id=0F22E127-206E-4BE3-A1FC-1078F65A743A&client_
secret=1E274C15-CC57-4DB9-A740-
BB3930FD07CE&scope=personalization&state=somespecificstring
Response example:
Web API | DELMIA Apriso 2024 15
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Content-Length: 417
{"access_token":"
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6InBlcnNvbmFsaXphdGlvbiIsImNsaWVudF9pZC
I6IjBGMjJFMTI3LTIwNkUtNEJFMy1BMUZDLTEwNzhGNjVBNzQzQSIsImp0aSI6IlN5c3RlbSIsImVxdWlwbWVud
CI6IiIsImxpY2Vuc2UiOiIiLCJpc3MiOiJBcHJpc28iLCJhdWQiOiJBcHJpc28iLCJleHAiOjE1MjY2NDM2NjQs
Im5iZiI6MTUyNjU1NzI2NH0.B5A52Y6cdszsyGUe04Xgs5wdNALDUYCYevLW_l74zrQ","token_
type":"Bearer","expires_in":86400,"state":"somespecificstring"}
By default, ClientApplications.xml already contains definitions of three clients which are able to
obtain access tokens from the Secure Token Service (STS):
FlexNetProcessBuilder
DELMIA Apriso Portal
DELMIA Apriso ${WebAddress} (where ${WebAddress} is resolved to server name)
If you change the <ClientId> of DELMIA Apriso Portal, you also have to modify the
scripts.js file found in <drive>\Program Files\Dassault Systemes\DELMIA Apriso
2024\WebSite\Portal\Scripts, where you need to change the value of TokenServiceClientId
to that of <ClientId>.
To register a client application with DELMIA Apriso, add an entry in the ClientApplications.xml
file and restart DELMIA Apriso services.
An entry for a new client application should have the following general structure:
Web API | DELMIA Apriso 2024 16
<ClientApplication name="{application_name}">
<ClientId>{client_id}</ClientId>
<ClientSecret>{client_secret}</ClientSecret>
<ApiKey>{api_key}</ApiKey>
<RedirectUris>
<Uri>{redirect_uri}</Uri>
</RedirectUris>
<Scopes>
<Scope name="{scope_name}"/>
</Scopes>
<SupportedGrants>
<Grant>{grant_type}</Grant>
</SupportedGrants>
</ClientApplication>
<ClientId> is the public ID of the client application which will be used for identification (the
preferred value format is GUID)
<ClientSecret> is a private key assigned to the client application which is used when
requesting an access token (the preferred value format is GUID)
<ApiKey> is a private key used for API key authorization (the preferred value format is GUID)
<RedirectUris> is a list of valid URLs that the Secure Token Service (STS) will send the
access token to (one of the URLs must be equal to
${WebRootURL}/Apriso/modules/oauth/oauth_callback.html)
<Scopes> is a list of valid scopes that the client application can request when obtaining a
token (see Scopes for a full list of default scopes)
<SupportedGrants> is a list of authorization flows supported by the client application. One or
more of the following grant types can be used:
Implicit – the implicit grant type is used to obtain access tokens (it does not support the
issuance of refresh tokens)
AuthorizationCode – the authorization code grant type is used to obtain both access
tokens and refresh tokens
Password – this grant type is suitable for clients capable of obtaining the resource owner’s
credentials (username and password)
ClientCredentials – the client can request an access token using only its client credentials
For detailed information on the authorization flows supported under OAuth 2.0, see
the OAuth 2.0 Authorization Framework.
Depending on which authorization mechanism (API key or access token) the client application
will be using, certain sections are obligatory:
<ClientSecret> ✓
<ApiKey> ✓
<RedirectUris> ✓
<Scopes> ✓
<SupportedGrants> ✓
Once the client application is registered, restart DELMIA Apriso services. The application will
then be able to request an access token from STS or call the API using the provided API key.
For more information on publishing Standard Operations in Process Builder, see the Web
Services Manager topic in the Process Builder Help.
You can use a tool such as Fiddler or Postman to test GET and POST requests.
Security
Three security levels are supported when calling Standard Operations published through the
DELMIA Apriso Web API:
Public
API Key
Access Token
The Operation has been published as a REST web service in the Web Services Manager (for
more information, see the Web Services Manager topic in the Process Builder Help).
For the sake of simplicity, the Operation's security level has been set to "Public", so that no
authorization headers are required (for more details on authorization headers, see 2.1 API Key
and 2.2 Access Token).
To obtain more information about the Operation, make a GET request, using the Accept header
to determine the Content-Type of the response (application/json or application/xml):
GET
http://{server_name}/Apriso/httpServices/operations/GetEmployee HTTP/1.1
Accept: application/json
Host: {server_name}
Web API | DELMIA Apriso 2024 19
All requests are made to the default revision of the Operation, unless a specific revision is
provided in the URL, e.g. http://{server_
name}/Apriso/httpServices/operations/GetEmployee/REV.001.001.
The API will give a response specifying the Operation's expected Inputs (Id: Integer) and
Outputs (Name: ListOfChar), as well as a sample payload:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/10.0
api-supported-versions: 1
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 17 Jan 2018 13:21:42 GMT
Content-Length: 227
{
"Inputs":[
"Id: Integer"
],
"Outputs":[
"Name: ListOfChar"
],
"ExecutionParameters":{
"Inputs":{
"Id":1
},
"ExecutionMode":1,
"JobPool":"DEFAULT",
"Retries":1,
"SleepTime":1000,
"SynchronuousQueue":"DEFAULT",
"Timeout":5000
}
}
The ExecutionParameters section contains a sample payload which you can use as a template
for the body of your POST request.
When making the request, use the Accept header again to determine the format of the
response: application/json or application/xml. Content-Type should correspond to the format
used in the body of your request.
The required Inputs should be placed in the request's body. Other parameters, such as
ExecutionMode or Timeout, are optional – if you do not provide them explicitly, defaults will be
Web API | DELMIA Apriso 2024 20
used (see 2.5.2 Execution Parameters below for more details on available execution
parameters):
POST
http://{server_name}/Apriso/httpServices/operations/GetEmployee HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: {server_name}
Content-Length: 234
{
"Inputs":{
"Id":1
},
"ExecutionMode":1,
"JobPool":"DEFAULT",
"Retries":1,
"SleepTime":1000,
"SynchronuousQueue":"DEFAULT",
"Timeout":5000
}
The API returns a list of Outputs. In this case, it is the Name (System Administrator) associated
with the provided Id (1):
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/10.0
api-supported-versions: 1
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 17 Jan 2018 13:36:36 GMT
Content-Length: 45
{
"Outputs":{
"Name":[
"System Administrator"
]
}
}
Web API | DELMIA Apriso 2024 21
Apart from the expected Inputs, you can also provide a number of other execution parameters
which will be passed on to Job Executor. If an execution parameter is not provided, the default
value will be used (see Table 1 Execution Parameters below).
For more information about how jobs are executed in DELMIA Apriso, see the Background
Job Processing Technical Guide.
Any entity which makes a web API available for use by other parties is called a web service
provider. In order to be able to call an external API from the Web API Client, its provider
must be added to the WebServiceProviders.xml file (for more information, see 3.2 Adding a
Web Service Provider).
Figure 3 Web API Client – HTML Layout Editor's JavaScript tab in Process Builder
3.1 Authorization
Depending on the authorization framework implemented by the API's provider, one of the
following client objects should be used in the HTML Layout Editor's JavaScript tab:
Apr.WebAPI.OAuthClient – for an access token-based flow compliant with the OAuth 2.0
specification (this is an Implicit Grant flow)
Apr.WebAPI.ApiKeyClient – for an API key-based flow
Apr.WebAPI.ThreeDPassportClient – for 3DPassport authentication
Each client's constructor accepts the name of the provider to be used, for example:
Once the correct client has been instantiated, it can be used to make requests to the API:
To register a web service provider with DELMIA Apriso, first register your application with the
provider, obtain the necessary configuration details (such as the endpoint, client ID, API key,
etc.) from the provider, and finally add an entry in the WebServiceProviders.xml file and restart
DELMIA Apriso services.
Before registering a provider, you should familiarize yourself with its documentation,
particularly with the methods of authenticating your requests.
Web API | DELMIA Apriso 2024 24
To register a new web service provider with DELMIA Apriso, add an entry in the
WebServiceProviders.xml file and restart DELMIA Apriso services.
The name of the provider, which must be unique, is used by the Web API Client. friendlyName
is used by the Web Service Function in Process Builder (for more information, see Process
Builder Help).
An entry for a web service provider may contain one or more of the following sections
corresponding to the authorization methods it supports:
<OAuth> for access token-based authentication
<ApiKey> for API key-based authentication
<ThreeDPassport> for 3DPassport authentication
Assuming a provider supports all three available authorization mechanisms (an access token,
an API key, and 3DPassport), its entry in WebServiceProviders.xml would look like this:
Web API | DELMIA Apriso 2024 25
<OAuth>
The <OAuth> section contains information required to call an access token-protected API.
Currently, two authorization flows are supported: <Implicit> and <ClientCredentials>. Any other
flows will be ignored. For detailed information on authorization flows, see 2.3 Authorization
Flows.
<AuthorizationUri> is the URL of the provider's token service
<Implicit> – the implicit authorization flow (this is the default flow for the Web API Client)
<ClientId> is the public ID of your registered client application or service, which will be
used for identification
<RedirectUri> is the URL where the access token will be sent
(${WebRootURL}/Apriso/modules/oauth/oauth_callback.html)
<Scope> is a comma-delimited list of the requested scopes (for more information on what
scopes are, see Scopes)
Web API | DELMIA Apriso 2024 26
<ClientCredentials> – the client credentials authorization flow (this is the default flow for the
Web Service Function in Process Builder; it is also used for machine-to-machine
authentication)
<Body> is the body of the request (use query-string formatting, i.e.
"field1=value1&field2=value2")
<AuthorizationHeader> is the provider-specific authorization header
<QueryString> is the query string to be attached to the request (if required by the provider).
Use "&" to separate individual parameters (e.g.
parameter1=value1&parameter2=value2).
<HttpMethod> is the HTTP method to be used, which can be either POST (default) or GET
<ApiKey>
<ThreeDPassport>
The <ThreeDPassport> section contains information required to call a web service which uses
3DPassport authentication.
Any server calling 3DPassport services must have HTTPS enabled. For more information,
see the Enabling HTTPS section in the Security Implementation Guide.
3.3 Functions
The Web API Client offers four function variants for each of the supported HTTP verbs (GET,
DELETE, POST, and PUT):
GET
Get (url)
Get (url, headers)
Get (url, successCallback, errorCallback)
Get (url, successCallback, errorCallback, headers)
Web API | DELMIA Apriso 2024 27
DELETE
Delete (url)
Delete (url, headers)
Delete (url, successCallback, errorCallback)
Delete (url, successCallback, errorCallback, headers)
POST
Post (url, data)
Post (url, data, headers)
Post (url, data, successCallback, errorCallback)
Post (url, data, successCallback, errorCallback, headers)
PUT
Put (url, data)
Put (url, data, headers)
Put (url, data, successCallback, errorCallback)
Put (url, data, successCallback, errorCallback, headers)
Where:
url is the endpoint to be used
headers are the request's headers
A Content-Type header must be provided with all POST and PUT requests (for more
information, see 3.4 Default and Custom Headers)
Not all clients support all four verbs (see the table below).
GET / DELETE
Below is an example of a GET request in an access token-based flow (the same example could
be used with API key and 3DPassport authentication, where ApiKeyClient and
ThreeDPassportClient would be used respectively instead of OAuthClient):
If no callbacks are specified, the function returns a promise (for more information on promises,
refer to MDN web docs):
POST / PUT
Below is an example of a POST request in an access token-based flow (in an API key-based flow,
ApiKeyClient would be used):
You can also provide your own custom headers. To do so, use a JSON object or a JSON string.
For example, in the code snippet below the headers variable ensures that an XML document is
returned in the response:
3.5 Debugging
When debugging the Web API Client in the DELMIA Apriso Portal, you can use the developer
tools in your Internet browser of choice.
However, be aware that in the DELMIA Apriso Portal, the Web API Client script is linked at the
level of the iframe which displays the content window (contentWindow). You should therefore
refer to this iframe when using the Client (replace #iframe_id with the ID of the iframe, or use its
class to identify it):
Note that both scenarios are based on the assumption that you already have the necessary
credentials to authorize requests (API key and client ID).
OAuth Authentication
This sample scenario shows how to obtain a list of messages in a user's inbox from the Gmail
API using DELMIA Apriso's Web API Client. All examples in this scenario will use a mock client
Web API | DELMIA Apriso 2024 30
ID, which should be replaced with valid credentials when making requests to the API.
Procedure:
1. Follow the instructions in Implementing Server-Side Authorization at Gmail API
documentationto register your application (DELMIA Apriso) and obtain a client ID.
Client ID:
887456409710-bv7a838sqvbofb6lc6q8ou7u7ctiq2ig.apps.googleusercontent.com
2. Consult Gmail API documentation to learn which endpoint to use, how to authenticate
requests, and which scopes are required to list a user's messages.
A list of all messages in a user's inbox can be obtained from the messages endpoint (replace
{user_email_address} with a specific email address):
https://www.googleapis.com/gmail/v1/users/{user_email_address}/messages
The access token can be obtained from the authorization URL below:
https://accounts.google.com/o/oauth2/auth
https://www.googleapis.com/auth/gmail.readonly
3. Add Gmail to WebServiceProviders.xml (for more information, see 3.2 Adding a Web Service
Provider) and restart DELMIA Apriso services.
<Provider name="Gmail" friendlyName="Google Mail">
<OAuth>
<Implicit>
<AuthorizationUri>https://accounts.google.com/o/oauth2/auth</AuthorizationUri>
<ClientId>887456409710-
bv7a838sqvbofb6lc6q8ou7u7ctiq2ig.apps.googleusercontent.com</ClientId>
<RedirectUri>${WebRootURL}/Apriso/modules/oauth/oauth_
callback.html</RedirectUri>
<Scope>https://www.googleapis.com/auth/gmail.readonly</Scope>
</Implicit>
</OAuth>
</Provider>
4. Use the following code snippet to call the API from within an Operation in Process Builder
(for more information, see 3 Web API Client):
Web API | DELMIA Apriso 2024 31
Note that a pop-up will appear asking the user to log in to Gmail and authorize your
application's access to their data. Make sure that browser settings allow pop-ups from
the domain on which the API call is made.
d0e841fadf87e22e9f1def6d7407fe77
http://api.openweathermap.org/data/2.5/weather
Web API | DELMIA Apriso 2024 32
The API expects a q parameter with the name of the city. Additionally, the API key should be
provided in an appid parameter with each request for authentication purposes:
q=London&appid=d0e841fadf87e22e9f1def6d7407fe77
http://api.openweathermap.org/data/2.5/weather?q=London&appid=d0e841fadf87e22e9f1def
6d7407fe77
Note that the Headers section is empty because the API does not expect any headers to
be provided with this request:
4. Use the following code snippet to call the API from within an Operation in Process Builder
(for more information, see 3 Web API Client):
var client = new Apr.WebAPI.ApiKeyClient("OWM");
var url = "http://api.openweathermap.org/data/2.5/weather";
client.Get(url, function(response){ console.log(response); }, function(){
console.log("ERROR"); });
{"coord":{"lon":-0.13,"lat":51.51},"weather":
[{"id":801,"main":"Clouds","description":"few
clouds","icon":"02d"}],"base":"stations","main":
{"temp":288.15,"pressure":1016,"humidity":67,"temp_min":286.15,"temp_
max":289.15},"visibility":10000,"wind":{"speed":4.1,"deg":360},"clouds":
{"all":12},"dt":1526975400,"sys":
{"type":1,"id":5091,"message":0.0036,"country":"GB","sunrise":1526961536,"sunset":15
27018981},"id":2643743,"name":"London","cod":200}
Web API | DELMIA Apriso 2024 33
4 Documentation Availability
All DELMIA Apriso documentation is available from <server name>/apriso/start and at 3DS
Support.
For more information, refer to the 3DS Support Knowledge Base.