Aras Innovator Platform

Web Service

The following steps outline the process of configuring a new Web Service:

  1. From the Table of Contents, expand Administrator and select External Access.
  2. Expand External Access and select Web Services.
  3. The Web Services TOC appears.

  4. Click Create New Web Service.
  5. The Web Service form appears.
  6. Enter the required value in the Title, Endpoint Name, and Description fields.
  7. Warning
    The Endpoint Name property is used in the Web Service’s URL. This string may include alphanumeric characters and underscores. Do not use spaces or other special characters.

  8. Click Done to save the changes.
  9. The newly created Web Service form appears:

Creating an Endpoint

An Endpoint describes the scope of data, actions, and custom logic allowed for a Web Service. A Web Service must have at least one active Endpoint to “publish” a REST API. A Web Service may also have multiple Endpoints, each with a version number and unique URL. This capability enables users to make significant changes to an API without breaking existing client applications or integrations.

Note
Because a REST API may have multiple active versions, Endpoints do not use the same behavior as other versionable items on the Aras Innovator platform. Refer to section Versioning a Web Service for more information about creating a new Web Service version.

The following steps outline the process to create a new Endpoint:

  1. Open the Web Service.
  2. Click Edit.
  3. Click Create New Version in the Endpoints section.
  4. A row will be added to the Endpoints grid.

  5. Click Save.
  6. The Version and the endpoint URL will be updated automatically. Each endpoint has a unique URL with the following format:

    {Innovator_url}/Server/ws/{endpoint_name}/v{endpoint_version}

  7. Select the Endpoint.
  8. Click Configure Endpoint.
  9. The Web Service Editor opens.

    The Web Service Editor consists of the following sections:

    • The pane on the left enables the user to view and modify the Web Service Items (ItemTypes) and Global Methods included in the endpoint’s scope.
    • The pane on the right enables the user to view and modify settings for any Web Service Item or Global Method selected in the left pane.

Adding ItemTypes

The following steps outline the process to add an ItemType to an Endpoint:

  1. Click Edit in the Web Service Editor.
  2. Click Add ItemTypes.
  3. The Select Items dialog box appears.

  4. Click Search.
  5. A list of all the ItemTypes displays.

  6. Select the required ItemType(s) and click OK.
  7. The selected ItemType(s) will be added to the Web Service Items list.

    Web Service Items may be removed from the Endpoint by selecting the item in the left pane and clicking the Delete button in the header of the right pane. Removing a Web Service Item from an Endpoint does not delete the ItemType from the database.

Configuring a Web Service Item

The following steps outline the process to configure a Web Service Item.

  1. Click on a Web Service Item in the left pane.
  2. The right pane will display settings for the Web Service Item in four tabs:

Web Service Item: Default tab displayed when a Web Service Item is selected Properties: Web Service Item’s properties that are available via the Endpoint Relationships: Web Service Item’s relationships that are available via the Endpoint Methods: Server Methods that can be run on the Web Service Item via the Endpoint

Web Service Item

  1. (Optional) Enter an Alias.
  2. This string defines the name of the entity type representing the associated ItemType in the published API. The default value will be the name of the selected ItemType, and all spaces will be replaced with underscores.

    Warning
    Because Alias is used as the entity type in REST API calls, it must be unique and cannot contain spaces or special characters.

  3. Select the Actions permitted for this Web Service Item. Get: Request item by id.
  4. Get List: Request item(s) without the id parameter. Requires Get to be selected.Add: Create a new item.Edit: Edit an item.Delete: Delete an item.

Note
Configurable Web Service obey all access controls configured on the Aras Innovator server. The Action settings for Web Service Items allow admins to permit or restrict certain operations for an Endpoint. Enabling an Action on a Web Service Item does not grant additional permissions.

Properties

The Properties tab displays a table of properties included in the scope of the selected Web Service Item. The column definitions are as follows: Property: Displays the name of the property Data Type: Displays the property’s data type as defined on the ItemType Property Data Source: Displays the property’s data source as defined on the ItemType Web Service Data Source: For properties with the “Item” data type, this field identifies a Web Service Item associated with the property’s Property Data Source. If the Endpoint has no corresponding Web Service Item, one will be created automatically.

Note
The id property is required for all Web Service Items and cannot be removed from the table.

The following steps outline the process to select properties for the Web Service Item:

  1. Click the Properties tab in the right pane.
  2. Click Add in the Properties tab.
  3. The Select Properties dialog opens.

  4. Select one or more properties.
  5. Click OK.
  6. The newly added properties will be displayed as shown below:

    Properties may be removed from the Web Service Item by selecting one or more properties and clicking the delete button directly above the table. Removing a property from a Web Service Item does not affect the ItemType definition.

Relationships

The Relationships tab displays the Relationship Types included in the scope of the selected Web Service Item. The column definitions are as follows:

  1. RelationshipAlias: Name of the RelationshipType
  2. RelatedAlias: Identifies a Web Service Item associated with the relationship’s ItemType. If the Endpoint has no corresponding Web Service Item, one will be created automatically.
    1. Click the Relationships tab.
    2. Click Add in the Relationships tab.
    3. The Add Relationships dialog appears. It lists the Relationships for the Web Service Item’s associated ItemType and the related ItemType.

      Select one or more Relationships.

    4. Click OK.
    5. The newly added relationships will be displayed in the table.

      Relationships may be removed from the Web Service Item by selecting one or more rows and clicking the delete button directly above the table. Removing a relationship from a Web Service Item does not affect the ItemType definition.

Methods

The Methods tab displays the item methods, or “bound methods”, included in the scope of the selected Web Service Item. These should be server Methods explicitly developed for a context item of this ItemType.

Note
All Server Events configured on the ItemType will function as expected for events triggered by REST requests. Those Methods only need to be added to the Web Service Item if they should be callable through the Endpoint.

The column definitions are as follows:

  1. Alias: The name used to execute the Method via the Endpoint
  2. Method: The server Method that will be executed
  3. Warning
    Because the Method Alias will be used in REST API calls, it must be unique and cannot contain spaces or special characters.

    The following steps outline the process of adding Methods:

    1. Click the Methods tab.
    2. Click Add in the Methods tab.
    3. The Select Item dialog appears.

      Click Run Search.

      A list of items will be displayed.

    4. Select one or more items.
    5. Click OK.
    6. The newly added records will be displayed.

      Methods may be removed from the Web Service Item by selecting one or more rows and clicking the delete button directly above the table. Removing a Method from a Web Service Item does not delete the Method from the database or affect the ItemType definition.

Adding Global Methods

Global Methods, or “unbound methods”, are server Methods that can be executed independently of a specific context item type.

The column definitions are as follows:

  1. Alias: The name used to execute the Method via the Endpoint
  2. Method: The server Method that will be executed
  3. Warning
    Because the Method Alias will be used in REST API calls, it must be unique and cannot contain spaces or special characters.

    The following steps outline the process to add Global Methods:

    1. Click AddGlobalMethods directly above the left pane.
    2. The Select Item dialog appears.

      Click Run Search.

    3. Click Search.
    4. A list of all the corresponding Items will be displayed.

      Select one or more server Methods.

    5. Click OK.
    6. The newly added method(s) are in the left pane.

    7. Click a GlobalMethod in the left pane.
    8. The right pane will display the Global Method’s settings in a single tab.

  4. Alias: The name used to execute the Method via the Endpoint
  5. Method: The server Method that will be executed
  6. Parameters: This table enables admins to define named parameters that may be passed in the body of a request for use in the server Method code
  7. Warning
    Because the Method Alias will be used in REST API calls, it must be unique and cannot contain spaces or special characters.

    Global Methods may be removed from the Endpoint by selecting the Method in the left pane and clicking the Delete button in the header of the right pane. Removing a Global Method from an Endpoint does not delete the Method from the database.

    1. Click Done to save the Endpoint.

Editing an Endpoint

The following steps outline the process to create a new Endpoint:

  1. Open the Web Service.
  2. Click Edit.
  3. Select the Endpoint by clicking on it.
  4. Click Configure Endpoint.
  5. The Endpoint opens in the Web Service Editor.

  6. Click Edit in the Web Service Editor.
  7. Edit the Endpoint as needed, following the appropriate steps from Sections 3.1.1.1 “Adding ItemTypes” and 3.1.1.2 “Configuring a Web Service Item”.
  8. ClickDone in the Web Service Editor when all edits are complete.

Publishing an Endpoint

Creating an Endpoint does not automatically make the REST API accessible. It must be published or made “active” before it can respond to requests. The following steps outline the process for publishing an Endpoint. Open the Web Service. Click Edit. In the Endpoints grid, enable the Active checkbox for the Endpoint to be published.

Click Done in the Web Service toolbar. The Endpoint is now published and can respond to HTTP requests. The Endpoint can be unpublished again by disabling the Active checkbox.

Note
The Active property can also be managed on the Endpoint form.

A Web Service may have multiple Endpoints, each describing a version of the Web Service. This enables the user to make significant changes to an API without breaking existing client applications or integrations. The following steps outline the process of versioning a Web Service with a new Endpoint. Open the Web Service. Click Edit. In the Endpoints grid, select the Endpoint that will be the basis of the new version. Click the Create New Version button in the grid toolbar.

Click Save in the Web Service toolbar. In the Endpoints grid, select the Endpoint with the new version. Click Configure Endpoint in the grid toolbar.

Edit the Endpoint as needed. Then Save the Web Service and publish the newest Endpoint version.

Note
A Web Service may have more than one published or “active” Endpoint, each with a unique url.

Creating an API Key

An API Key enables the Aras Innovator server to authorize requests and execute the request as the User associated with the key. API Keys are most commonly assigned to a service User that is used for server-to-server requests or other scenarios where an end user cannot be prompted for credentials.

Note
Applications and integrations that execute requests as a specific end user should use the OAuth credential flow instead of API Keys. This is the same authorization approach supported by the platform’s default REST API. Refer to section XXX below for more details.

API Keys contain the following properties: Name: Name of the API Key

User: The User that will be used for all requests made with this key. If a user is not entered, a system user will be automatically generated.

Description: Description of the API Key Created By: The User who created the API key Created On: When the API key was created

Warning
After generating the API Key, please copy and store it securely, as it will not be visible again.

Note
System Users generated for API Keys are not automatically added to any group identities or access control configurations. Be sure to check that generated system users have permission to perform the operations described in the Endpoint.

The following outlines creating an API Key for a Web Service.

  1. Open the Web Service.
  2. Click Edit.
  3. Click the API Keys tab.

  4. Click the New API Key button.
  5. A new record will be added to the table, as shown below:

  6. Enter Name.
  7. (Optional) Enter the User that will be used for all requests made with this API Key.
  8. If a User is not selected, one will be generated. If using a generated user, be sure to grant that user permission for the requests that will be made with the API Key.
  9. Click Save.
  10. Saving the record will display the API key. Save the key, as it will not be visible after creation.

  11. Click Done.
  12. The newly added API key will be displayed.

The Configurable Web Service produces REST APIs that follow the same OData protocol used by the platform’s default REST API. As a result, sending requests and receiving responses from a CWS Endpoint is very similar to the default REST API. This section will outline steps that are unique to using a CWS Endpoint and provide references to the RESTful API documentation for steps shared with the default API.

Request URL Format

Each Aras Innovator instance has one endpoint for the default REST API. This default endpoint URL uses the following format:

{Innovator_url}/Server/odata/{…}

However, CWS can produce multiple REST APIs – each with a unique endpoint URL in the following format:

{Innovator_url}/Server/ws/{endpoint_name}/v{endpoint_version}/{…}

To confirm the Endpoint URL(s) for a REST API published via CWS, open the Web Service item and check the Endpoints tab.

Request Authorization

All requests sent to the Aras Innovator server must be properly authorized. For the platform’s default REST API, that means an application must request an access token from the OAuth server and include it in the headers of each HTTP request. CWS supports both OAuth access tokens and API Keys. The following sections outline how to use each authorization approach in a request to a CWS Endpoint.

OAuth Token

The process for using an OAuth access token with a CWS Endpoint is the same as the process for the default REST API.

Note
Refer to section Using OAuth 2.0 Tokens from the Authentication Server in the Aras Innovator REST API documentation for step-by-step instructions.

API Key

The following steps outline the process of using an API Key to authorize a request to a CWS Endpoint.

Note
This example uses the Postman HTTP client on the desktop. However, the general concept of passing the API Key in the request’s Authorization header applies to any HTTP request.

Download the Postman application on the local machine. Under My Workspace, select Collections and click Create New Collection. Provide a name for the new Workspace. For example, “CWS Collection”.

Click Add a request under the new Collection.

Provide a name for the new Request. For example, “Metadata”. In the address bar, enter the CWS Endpoint URL.

Click the Auth tab.

Select API Key from the Type dropdown.

In the Value field, enter “apikey ” followed by an API Key generated with the steps in section Creating an API Key.

Note
It’s important to include a space between the “apikey” prefix and the key’s value.

Click Send. The request should return a 200 OK response and the response body will appear in the bottom pane of the Postman application.

Metadata Endpoint

REST APIs published with CWS have a special metadata endpoint that describes the API’s schema in an Odata-compliant format. This schema can be accessed with the Endpoint url as shown in the previous section. It can also be accessed by appending #metadata to the Endpoint url.

Entities

The scope of the platform’s default REST API includes all ItemTypes and server Methods in the Aras Innovator database. This contrasts with the scope of CWS-published APIs, which include only the data and logic described in the Endpoint configuration. For example, CWS Endpoint that permits “get all” for Documents will respond with a 200 OK status and Document data in the response body.

However, the same CWS Endpoint will respond with a 400 Bad Request status if it receives a request for an ItemType that is not included in the scope.