API Uses

The following API usage examples are provided in this article:

 

Authentication and Authorization Login (POST)
Searches & Quickserches Resources Useful /searches filters

Work Order

Create a Work Order from an external system (POST)

Work Order

Update a Work Order in Asset Essentials from an external system (PUT)

Work Order

Retrieve Work Order Labor Records (GET)

Work Order

Retrieve Work Orders that have been modified in the past X minutes (POST)

Work Order

Retrieve Completed Work Orders by simple date and status filter (GET)

Work Order

Retrieve Completed Work Orders using search filters (POST))

Work Order

Find Work Orders with Part Cost data (POST)

Work Order

QuickSearch Work Orders using body filters (POST)

Work Order

Add Asset Work Order (POST)

Work Order

Full Work Order Update (PUT)

Work Order

Partial Update Work Order (PUT)

Purchase Order

Retrieve Work Order Labor Records (GET)

Purchase Order

Update a Work Order in Asset Essentials from an external system (PUT)

Assets

Batch Add Asset (POST)

Assets

Add Asset Work Order (POST))

Assets

Update a Work Order in Asset Essentials from an external system (PUT)

Assets

Add Meter Reading to Asset (POST)

Assets

Get Asset (GET)

 

Authentication and Authorization

Asset Essentials uses a username and password for authentication and a token system for request authorization. When you authenticate with your credentials in the body of your login request, you will be returned a token to use with all subsequent requests to the API endpoints.

 

Supported Methods

POST

 

There are individual endpoints for logging in and logging out of the API. Both /login and /logout endpoints use the POST method.

 

The /login endpoint HTTP sample request:

Copy
POST /login HTTP/1.1
Host: {{AE_URL}}
Content-Type: application/x-www-form-urlencoded

 

In response you will receive a token in the response body. This token will be required as an Authorization header in all subsequent API requests. The provided token will remain valid for the Expires=120 period you had specified in the Authentication request to the /login endpoint. Time is in minutes.

Copy
GET /workorders? HTTP/1.1
Host: {{AE_URL}}
Authorization: Basic {{AE_TOKEN}}
Content-Type: application/json

 

Login (POST)

Copy
{{AE_URL}}/login

Required Fields

LoginName

Username as set in Asset Essentials

Password

Password as set in Asset Essentials for given username

CultureCode

Language code for user account as set in Asset Essentials

Expires

Time in minutes before the returned authorization token expires

 

Fields are passed in the body of the request. In return an authorization token is returned which must be sent as a Basic Authorization token with every API request.

 

Authorization: Basic @4bfPC1M0GGyno+JPR8kwtUUF/P/az8NPgnNWY3ywe8aICSnuqdad6TktU2alIYAhyr/gBSdfsdfxq1Fqv0FGgdhIAaw==

 

Headers

Content-Type

application/x-www-form-urlencoded

Body

urlencoded

LoginName

{{LOGIN_NAME}}

Password

{{PASSWORD}}

CultureCode

en-US

Expires

120

 

 

 

Searches and QuickSearches Resources

Usage

As the name implies, the /searches and /quicksearches resources of the various Asset Essentials endopoints are used to perform filtered searches for work orders. For example, while the /workorder endpoint will return objects with a bulk GET request, it has very few filtering options and is not the suggested method to bulk return filtered work order data. With the searches resources you can send a JSON formatted body containing filter parameters which will return matching results.

 

This example is given for /workorders but it works the same with other endpoints with these resources.

 

Methods

The /searches and /quicksearches resource only supports the POST method.

Useful /searches filters

WOStatus

Filters based on the supplied WoStatusID and MatchType values.

DateAssigned, DateCompleted, DateCreated, DateLastModified, DateOriginated

Filters based on a combination of StartValue and EndValue fields in a supported format like 2021-02-17T21:28:52.513Z. See special notes section below for supported formats.

LastModifiedBy

Filter based on the last user to modify the work order object using a String and MatchType value.

 

Special Notes

An Options section can be included in the request body to control the inclusion and presentation of fields in the response body. The most common option is "PopulateCustomFields": true which overrides the default behavior of NOT including custom field data.

 

You must include both the StartValue and EndValue when filtering by a date field as omitting either one will result in no matches.

 

The API expects Date filters to use UTC for time components in requests, but it returns the time using the API account's local time. We recommend that you set your API account's time zone to UTC (UTC-0) to avoid confusion.

Acceptable Date Formats

Format

Example

mm/dd/yyyy or mm/dd/yy

01/15/2019 or 01/15/19

mm-dd-yyyy or mm-dd-yy

01-15-2019 or 01-15-19

yyyyy/mm/ddThh:mm:ss

2019/01/15T00:00:00

yyyy-mm-ddThh:mm:ss

2019-01-15T00:00:00

 

Filters have a Value and a MatchType. The filters can be strings, IDs or numbers and each of the three types have valid MatchTypes that work with them. The list below are the MatchTypes you can use with each type of filter.

 

Valid match types for string filters:

  • BeginsWith

  • Contains,

  • EndsWith

  • DoesNotEqual

  • NotSet

  • IsNull

  • IsNotNull

 

Valid match types for ID filters:

  • Equals

  • DoesNotEqual

  • IsNull

  • IsNotNull

 

Valid match type for numerical filters:

  • IsLessThan

  • IsLessThanOrEqualTo

  • IsGreaterThan

  • IsGreaterThanOrEqualTo

  • Equals

  • DoesNotEqual

  • NotSet

 

/Searches & /Quicksearches Filter List

The following is a complete listing of the /searches filters that are available for use.

 

Work Order

Usage

The workorders endpoint allows you to interact with work order objects in Asset Essentials. Many additional data collections are tied to work orders and can be retrieved with, or are required, to create or update a work order object. This endpoint supports GET, POST, PUT and DELETE methods.

 

Supported Methods

GET

Bulk vs Individual GET requests - This endpoint allows you to make a bulk request to return all objects or with an ID to return a single object. The format for bulk requests is /workorders where individual objects is /workorders/{{ID}}.

 

POST

Work orders must be categorized as being Location, Asset, Site or MeterTitle based, and you will need to pass in the appropriate TypeID and all required sub-collection IDs.

 

PUT

When updating work orders you have 2 methodologies to take into consideration.

 

  1. Send all pertinent work order fields and data back with the PUT request. By default, the PUT method replaces all fields with the data that is sent to the API. If you do not send all existing data back with a PUT request, that data will be replaced with a NULL value.

  2. Use the fieldstoupdate collection to specify the fields to be updated. Any field names you include in this collection will be update and all other fields will be ignored, even if they are included in the PUT request. This behavior is similar to a PATCH request and allows limited updates to data.

 

DELETE

You pass a WorkOrderID on the URL to target a specific work order for deletion.

 

Special Notes

Custom Fields are returned from an individual GET request when you pass a WorkOrderID on the URL. When performing a bulk GET (no ID passed) the custom fields are not returned by default. If you need to perform a bulk GET and require custom fields you will need to pass the ?showcustomfields=true parameter on the URL. A better way to return bulk work order data is to use the /workorders/searches endpoint which allows much more extensive filtering.

 

For work order creation you will need to pull object IDs from the /locations, /assets, or /sites endpoints depending on the SourceTypeID you pass. SourceTypeID indicates the type of Work Order you are creating. The following are Valid IDs:

  • 1=Site

  • 2=Location

  • 3=Asset

  • 4=MeterTitle

 

All work orders have an OriginType that indicates a Preventative Maintenance (PM) or Non-Preventative (Non PM) origin. These are system IDs and cannot be changed. The following are Valid IDs:

  • 0=PM

  • 1=Non PM

 

Remember that simple filters can be added as a query parameter on Get requests. These can be used whenever an endpoint does not have a full /searches endpoint or you just need a quick and easy filter.

 

Create a Work Order from an external system (POST)

Copy
{{AE_URL}}/v2/workorders

 

Scenario

You have a system for end users to create work orders, but you need your maintenance staff to use Asset Essentials for their day to day work order tracking and workflow. In this example you are creating a Location work order.

Business Requirements

You need to push work order data into Asset Essentials but do not need to pull data back out to update your external system. You only need the Asset Essentials work order number for reference.

Data Requirements

Your external system has roughly similar data requirements to Asset Essentials as they are both dealing with work order in this scenario. You will identify and map the external system's fields to their corresponding fields in Asset Essentials. A good strategy for this is to compare the GUI interface from both systems as well as their respective API field. For Asset Essentials you perform a GET on the /workorders endpoint, passing the WorkOrderId value as a parameter. You send /workorders/1 to the endpoint and receive the available objects belonging that work order. You note that the WorkOrderId is the internal ID and not necessarily the same as the WorkOrderNumber that is visible in the Asset Essentials GUI.

Minimum Recommended Fields

SourceType

The focus of the work order being created. Types are Site, Location, Asset or MeterTitle. See initial API documentation for valid IDs[BD1] .

WOStatusID

Status of the work order. Valid WOStatusID values can be retrieved from /wostatuses.

Name

String value that shows up as the Title field in the GUI.

WorkRequested

String value that shows up as the Work Requested field in the GUI.

LocationID

The ID of the location being targeted for the work order. LocationIDs be retrieved from /locations.

OriginType

Indicates whether the work order is PM on Non PM based. See Special notes in general Work Order section for valid IDs. If you make the Work Order Non-PM then you will also need to specify the OriginUserID value. If the OriginType field is not sent, the Work Order is defaulted to PM based.

OriginUserID

The ID of the user creating the Work Order. Should be the ID of the API access account. Can be found in the GUI or from /users/current endpoint. This is a required field for Non-PM Work Orders.

UserIds

Work Orders must be assigned to a worker. You can assign single or multiple workers to a Work Order. "UserIds": "5" for single workers or "UserIds": "5,6" for multiple workers.

 

Workflow

  1. Determine the appropriate values for the SourceType, OriginType, WOStatusId, and LocationID.
  2. Query these values and place them in lookup tables for your middleware to use.
  3. Record the external system's internal ID for the work order to set as a custom field in Asset Essentials.
  4. Once you have all the required IDs identified, you construct a POST request to submit the work order to Asset Essentials.

 

API Request

Create a new Work Order.

 

Request URI: POST /v2/workorders

 

Request Body Content

Copy
{
    "SourceType": 2,
    "OriginType": 1,
    "WOStatusId": 2,
    "OriginUserID": 7,
    "Name": "Paint warning lines around line 2",
    "WorkRequested": "Prime and paint safety and hazard warning lines around equipment",
    "SourceLocations": [
        {
            "LocationId": 2
        }
    ],
    "CustomFields": [
        {
            "Name": "External WO_ID",
            "Value": "21253"
        }
    ]
}

 

Response Body

The complete work order object will be returned on a successful POST request (some data omitted for clarity) .

 

Copy
{
    "WorkOrderId": 9,
    "WorkOrderNo": "0000000009",
    "CreatedOn": "2021-02-10T11:38:15.64",
    "DateOriginated": "2021-02-10T11:38:00",
}

 

Updating the External System

You extract the WorkOrderId value from the response body and store it in your external system as the Asset Essentials internal ID. You also extract the WorkOrderNumber, and DateOriginated values to store as an end user reference to the Work Order in Asset Essentials.

 

Headers

Authorization

Basic {{ae_token}}

Content-Type

application/json

 

Body

Raw

Copy
{
    "SourceType": 2,
    "OriginType": 1,
    "OriginUserID": 7,
    "WOStatusId": 2,
    "Name": "Paint warning lines around line 2",
    "WorkRequested": "Prime and paint safety and hazard warning lines around equipment",
    "SourceLocations": [
        {
            "LocationId": 2
        }
    ],
    "CustomFields": [
        {
            "Name": "External WO_ID",
            "Value": "21253"
        }
    ]
}

 

Create a work order from an external system - Example Request and Response

 

Update a Work Order in Asset Essentials from an external system (PUT)

Copy
{{AE_URL}}/workorders/10

 

Scenario

You have already implemented an integration with an external system to create work orders in Asset Essentials. You now need to be able to update the work orders in Asset Essentials when they are updated in your external system.

Business Requirements

You monitor your external system for changes to certain Work Order fields and need to update them as soon as those changes are detected. You do not need to update all fields, just the ones that are changed.

Data requirements

  • Required data will be the WorkOrderID and the modified data of the work order you need to update.

  • There is a limited and consistent set of fields that need to be updated, so you will send all of those fields so that every payload is consistent and you don't need to worry about building dynamic request bodies.

  • Each work order update will be sent as a single API request as they cannot be batched together.

  • You will use the PUT method to update the Work Order. You can send partial updates (like a PATCH method) by using the fieldstoupdate collection in the request body. If you do not use the fieldstoupdate collection then you need to send back all existing Work Order data. Please see the section on partial vs full updates at the beginning of Asset Essentials API documentation.

Workflow

  1. Identify work orders that have been updated in the external system. Pull all data required for your request body fields.

  2. Construct your URI using the Asset Essentials WorkOrderID that you received when you initially created the work order from the external system.

  3. Send the request using the PUT method to /v2/workorders/{{WorkOrderID}} to update the identified Work Order.

API Request

Update an existing Work Request.

 

Request URI: POST v2/workorders/{{WorkOrderID}}

 

Request Body Content

Copy
{
    "DateExpected": "2021-04-06T16:30:00",
    "Name": "Paint warning lines around line 2",
    "WorkRequested": "Prime and paint safety and hazard warning lines around equipment",
    "WOStatusId": 3,
    "PriorityId": 3,
    "CostCenterName": "Manufacturing",
    "CustomFields": [
        {
            "Name": "External System ID",
            "Value": "21253"
        }
    ],
    "FieldsToUpdate": [
        "DateExpected",
        "Name",
        "WorkRequested",
        "WOStatusId",
        "PriorityId",
        "CostCenterName",
        "CustomFields"
    ]
}

 

Response Body (some data omitted for clarity)

Copy
{
    "WorkOrderId": 10,
    "DateExpected": "2021-04-06T16:30:00",
    "Name": "Paint warning lines around line 2",
    "WorkRequested": "Prime and paint safety and hazard warning lines around equipment",
    "WOStatusId": 3,
    "WOStatusName": "In Progress",
    "WOTypeId": 11,
    "WOTypeName": "Mechanical",
    "WorkTypeId": 10,
    "WorkTypeName": "Corrective Maintenance (CM)",
    "PriorityId": 3,
    "PriorityName": "Medium",
    "CostCenterId": 1,
    "CostCenterName": "Manufacturing",
    "CustomFields": [
        {
            "Name": "External System ID",
            "Value": "21253",
        }
    ]
}

 

Headers

Authorization

Basic {{ae_token}}

Content-Type

application/json

 

Body

Raw

Copy
{
    "DateExpected": "2021-04-06T16:30:00",
    "Name": "Paint warning lines around line 2",
    "WorkRequested": "Prime and paint safety and hazard warning lines around equipment",
    "WOStatusId": 3,
    "PriorityId": 3,
    "CostCenterId": 1,
    "CustomFields": [
        {
            "Name": "External System ID",
            "Value": "21253"
        }
    ],
    "FieldsToUpdate": [
        "DateExpected",
        "Name",
        "WorkRequested",
        "WOStatusId",
        "PriorityId",
        "CostCenterId",
        "CustomFields"
    ]
}

 

Update a Word Order in Asset Essentials from an external system - Example Request and Response

 

 

Cache-Control

no-cache

Pragma

no-cache

Content-Type

application/json; charset=utf-8

Expires

-1

X-Frame-Options

SAMEORIGIN

Strict-Transport-Security

max-age=31536000;includeSubDomains

Date

Wed, 07 Apr 2021 15:33:49 GMT

Content-Length

11803

 

Retrieve Work Order Labor Records (GET)

Copy
{{AE_URL}}/v2/workorders/2/wolabors

 

Scenario

Extract completed Work Order data and related Work Order Labor records : You are required to pull the data on completed work orders and their associated labor records out of Asset Essentials so they can be added to your executive rollup dashboards in your reporting system.

Business Requirements

You need to pull the data every Sunday so that the data is ready for review Monday afternoon. You will pull Work Order data from Sunday morning to Saturday night. You need all work orders regardless of site or cost center so you will not need extensive filtering, just the CompletedDate.

Data Requirements

You will need to pull data based on the following data Requirements:

  1. Work Orders that have the Completed Status.

  2. Work Orders completed between Sunday and Saturday of the preceding week.

  3. Work Order Labor Records for all identified work orders.

  4. You will use a simple URI filter with a CompletedDate value.

 

Note: If you wanted to have a more complex WorkOrder filter you would want to use either the /v2/workorder/quicksearches which returns just ItemId, ItemNo, and ItemName fields for easy identification, or the more verbose /workorders/searches that returns the complete WorkOrder data model.

WorkFlow

  1. Make a GET request to the /workorders endpoint with the Between filter using the CompletedDate fields.

  2. Extract the WorkOrderID values for all returned work orders so they can be used to pull the related labor records.

  3. Make a GET request to the /workorder/{{ID}}/WOlabors endpoint for each WorkOrderID that you extracted.

  4. Use the returned Work Order and Work Order Labor data to import into your external system.

API Workflow

GET Work Orders completed since the specified date

Request URI: /workorders?filter=wostatusname='completed' AND datecompleted>=%28%232020-11-08T00:00:00%23%29

 

Notes:

  1. No body is required for the request.

  2. The expected date format is (#2021-03-11T00:00:00#) so you will need to url encode the(##) characters so they can be passed as a query parameter. The properly encoded format would be %28%232021-03-11T00:00:00%23%29

  3. You are specifying that the Work Order has a Completed status because any Work Order that had its status changed from Completed may still have old completion dates associated with it until it is marked complete once again

 

Response Body(Some data omitted for clarity)

Copy
{
    "Items": [
        {
            "WorkOrderId": 2,
            "GeneratedFrom": "Asset Essentials",
            "CreatedOn": "2020-09-21T09:09:21.95",
            "LastStatusChangedOn": "2020-11-09T09:50:37.413",
            "DateCompleted": "2020-11-09T05:00:00",
            "Name": "Roller de-greasing",
            "WorkOrderNo": "0000000002",
            "LaborHours": 12.0,
            "LaborCost": 180.0,
            "LaborNonUserCost": 0.0,
            "PartCost": 8.99,
            "PartNonInventoryCost": 0.0,
            "OtherHours": 0.0,
            "OtherCost": 0.0,
            "TotalHours": 12.0,
            "TotalCost": 188.99,
            "WOStatusId": 7,
            "WOStatusName": "Completed",
          }
  "HasNextPage": false,
  "HasPreviousPage": false,
  "PageIndex": 0,
  "TotalItems": 1,
  "TotalPages": 1,
  "PageNumber": 1,
  "PageSize": 10
    ]
  }

 

Extract the necessary data for retrieving Work Order labor Records

You may wish to store the Work Order details returned from the GET request but you will need the WorkOrderID value from each returned record. You can use the returned "TotalItems": 1, value to ensure that you have recorded the correct number of WorkOrderID values as there is one ID value per returned Item.

GET Work Order Labor Records

You will need to pass the WorkOrderID of the returned WorkOrders to the /v2/workorders/{ID}/wolabors endpoint. Each ID will need to be passed one at a time and the response will include all of the recorded labor records as individual items.

 

Request URI: /v2/workorders/{ID}/wolabors where {ID} is the individual WorkOrderID Value.

Note: No body is required for the request

 

 

Use the WorkOrder and Labor records to create labor records in your external system

Labor Records are linked to a WorkOrderID. With the combined response data from the endpoints above you can created both Work Order records and Labor records in your external system with the appropriate level of required data. If needed, you could use this information to perform CRUD operations on the Asset Essentials Work Order and Labor records if they were changed in your external system.

 

Headers

Authorization

Basic {{ae_token}}

Content-Type

application/json

 

Params

PageSize

2

PageNumber

4

 

Retrieve Work Order Labor Records - Example Request and Response

Example Request

Copy
curl --location -g '{{AE_URL}}/v2/workorders/2/wolabors' \
--header 'Authorization: Basic {{ae_token}}' \
--header 'Content-Type: application/json'

 

 

Example Response Headers

Cache-Control

no-cache

Pragma

no-cache

Content-Length

2650

Content-Type

application/json; charset=utf-8

Expires

-1

X-Frame-Options

SAMEORIGIN

Strict-Transport-Security

max-age=31536000;includeSubDomains

Date

Wed, 31 Mar 2021 20:54:41 GMT

 

Retrieve Work Orders that have been modified in the past X minutes (POST)

Copy
{{AE_URL}}/workorders/searches

 

Scenario

You need to update an external system's work orders with changes from Asset Essentials.

Business Requirements

You have determined that you want to update records every 30 min. You are also updating work orders in Asset Essentials through the API so you do not want to sync data that was last updated by your API user as this would cause an update loop.

Data Requirements

You determine that you need to use the LastModifiedBy and DateLastModified filters to return only the necessary work orders.

You will use the string MatchType of DoesNotEqual with the LastModifiedBy filter value to exclude your API user account.

WorkFlow

Your middleware will determine the necessary start and end datetime for your /searches request using UTC as the time zone.

You will use the time along with your API user name to construct your API request.

The request will return JSON formatted work order objects which you will use to update your external system's data with.

API request

Searching for matching Work Orders.

 

Request URI: POST /workorders/searches

 

Request Body

Copy
{
    "LastModifiedBy": {
        "Filters": [
            {
                "Value": "API User",
                "MatchType": "DoesNotContain"
            }
        ]
    },
    "DateLastModified": {
        "StartValue": "2021-02-08T16:00:00",
        "EndValue": "2021-02-08T16:30:00"
    }
}

 

Response Body (Some data omitted for clarity)

Copy
{
    "Items": [
        {
            "WorkOrderId": 7,
            "GeneratedFromIdUrl": null,
            "LastModifiedBy": "Bill Smith",
            "LastModifiedOn": "2021-02-08T16:28:28.497",
            "CreatedBy": "Adam Jones",
            "CreatedOn": "2021-02-08T16:28:28.123",
            "SourceType": 1,
            "OriginType": 1,
            "Name": "Site Inspection",
            "WorkRequested": "Inspect site for fire hazards\r\n",
            "WOStatusId": 3,
            "WOStatusName": "In Progress"
        }
    [
}

 

Updating the external system

You extract the required fields above from the response body and store them in your external system.

 

Headers

Authorization

Basic {{ae_token}}

Content-Type

application/json

 

Body

Raw

Copy
{
    "Options": {
        "PopulateCustomFields": true,
        "PopulateMedium": true,
        "PopulateSource": true,
        "PopulateParentPaths": true,
        "ParentPathDelimiter": "--",
        "TotalItems": 0,
        "TotalObjectCountOption": "TotalObjectCount"
    },
    "Page": {
        "PageNumber": 1,
        "PageSize": 200
    },
    "LastModifiedBy": {
        "Filters": [
            {
                "Value": "Tool User",
                "MatchType": "DoesNotContain"
            }
        ]
    },
    "DateLastModified": {
        "StartValue": "2021-02-08T16:00:00",
        "EndValue": "2021-02-08T16:30:00"
    }
}

 

Retrieve Work Orders that have been modified in the past X minutes - Example Request and Response

 

 

Retrieve Completed Work Orders by simple date and status filter (GET)

Copy
{{AE_URL}}/workorders?filter=wostatusname='completed' AND datecompleted>=%28%232020-11-08T00:00:00%23%29&customfields=true

 

While this method is quick and easy, it is not the recommended method to perform bulk Work Order searches. You should instead be using the /workorders/searches endpoint instead as it is much more flexible. This example is provided as an example of using query parameter filters.

Usage

  • This search method is typically used when there is no endpoint specific /searches or /quicksearches endpoint.

  • You define the filter by using the format ?filter=fieldName=value.

  • You can combine filters using AND, OR, BETWEEN keywords depending on the field and value used.

  • Additional query parameters to control paging and custom field display can be added by using an ampersand (&) connector.

API Request

This request looks for work orders with a status name instead of an ID, a completed date greater than and equal to a provided date and also include custom fields in the response body. The idea behind this request is to find Work Orders that were completed since a specified date. You might use this with a rolling datecompleted value to find Work Orders completed on a weekly basis.

 

Request URI: GET /workorders?filter=wostatusname='completed' AND datecompleted>=%28%232020-11-08T00:00:00%23%29&customfields=true

 

Request Body

No body is required for this request. All filters are sent as query parameters on the URI.

 

Response Body (Some data removed for clarity)

Copy
{
    "Items": [
        {
            "WorkOrderId": 2,
            "LastModifiedOn": "2021-03-17T09:00:29.06",
            "SourceType": 3,
            "OriginType": 1,
            "DateCompleted": "2020-11-09T05:00:00",
            "Name": "Roller de-greasing",
            "WorkOrderNo": "0000000002",
            "LaborHours": 12.0,
            "LaborCost": 180.0,
            "PartCost": 8.99,
            "TotalCost": 188.99,
            "WorkRequested": "De-grease the rollers on Line 2\r\n",
            "Action": "De-Greased rollers\r\n",
            "Comment": "- First Comment\r\n- Second Comment\r\n- Using html paragraph",
            "WOStatusId": 7,
            "WOStatusName": "Completed",
            "WOTypeId": 11,
            "WOTypeName": "Mechanical",
            "WorkTypeId": 14,
            "WorkTypeName": "Preventive Maintenance (PM)",
            "WorkCategoryId": 11,
            "WorkCategoryName": "Mechanical",
            "CustomFields": [
            {
                "Name": "External System ID",
                "Value": "56897845",
            }
        ],
        }
    ]
}

 

Headers

Authorization Basic {{ae_token}}
Content-Type application/json

 

Params

PageSize Basic {{ae_token}}
PageNumber application/json
filter wostatusname='completed' AND datecompleted>=%28%232020-11-08T00:00:00%23%2
customfields true

 

Retrieve Completed Work Orders by Simple Date and Status Filter - Example Request and Response

Example Request

Copy
curl --location -g '{{AE_URL}}/workorders?filter=wostatusname%3D%27completed%27%20AND%20datecompleted%3E%3D%2528%25232020-11-08T00%3A00%3A00%2523%2529' \
--header 'Authorization: Basic {{ae_token}}' \
--header 'Content-Type: application/json'

 

 

Retrieve Completed Work Orders using search filters (POST)

Copy
{{AE_URL}}/workorders/searches

Scenario

You have a data lake feeding your Executive Dashboards and want to include Work Order data from Asset Essentials.

Business Requirements

You have determined that you want to pull Work Order Completion data for the previous full month for inclusion in your corporate data lake. You only want Work Orders that were marked complete during that time period. You will use the returned StartDate value to determine the days each Work Order was open. You need to determine the Work Orders average days open on a monthly basis.

Data Requirements

You determine that you need to use the DateCompleted filter to return only the necessary work orders.

You will use the returned CreatedOn value to determine the days each Work Order was open.

WorkFlow

  1. Your middleware will determine the necessary StartValue and EndValue datetime for your /searches request using UTC as the time zone taking into account the first and last days of the previous month.

  2. You will use the StartValue and EndValue in the DateCompleted filter to construct your API request.

  3. The request will return JSON formatted work order objects which you will use to update your external system's data lake.

API request

Searching for matching Work Orders.

 

Request URI: POST /workorders/searches

 

Request Body

Copy
{
    "Options": {
        "PopulateCustomFields": false,
        "PopulateMedium": false,
        "PopulateSource": false,
        "PopulateParentPaths": false,
        "ParentPathDelimiter": "--",
        "TotalItems": 0,
        "TotalObjectCountOption": "TotalObjectCount"
    },
    "Page": {
        "PageNumber": 1,
        "PageSize": 200
    },
    "DateCompleted": {
        "StartValue": "2020-09-01",
        "EndValue": "2020-09-30"
    }
}

 

Updating the external system

You extract the required fields above from the response body and store them in your external system.

 

Headers

Authorization

Basic {{ae_token}}

Content-Type

application/json

 

Body

Raw

Copy
{
    "Options": {
        "PopulateCustomFields": false,
        "PopulateMedium": false,
        "PopulateSource": false,
        "PopulateParentPaths": false,
        "ParentPathDelimiter": "--",
        "TotalItems": 0,
        "TotalObjectCountOption": "TotalObjectCount"
    },
    "Page": {
        "PageNumber": 1,
        "PageSize": 200
    },
    "DateCompleted": {
        "StartValue": "2020-09-01",
        "EndValue": "2020-09-30"
    }
}

 

Retrieve Completed Work Orders using search filters - Example Request and Response

 

Find Work Orders with Part Cost data (POST)

Copy
{{AE_URL}}/v2/workorders/quicksearches

Scenario

You need to pull part usage information from Asset Essentials for Executive Dashboard reporting.

Business Requirements

You need to pull parts usage for completed work orders on a weekly basis.

Data requirements

  1. You do not need all of the work order details for your reporting, just the part usage information.

  2. You will use the /v2/workorders/quicksearches endpoint in combination with the WOStatusId and DateCompleted filters. The quicksearches endpoint allows greater flexibility than the basic query parameters but only returns the ItemID, ItemNo and ItemName fields.

Workflow

  1. POST a filtered request to /v2/workorders/quicksearches with filter values to find all of the Work Orders completed in the last week that have a Parts Cost greater then 0.

  2. Store the returned data to make it available for further processing.

  3. POST a request to /v2/workorders/{{ID}}/WOParts with the returned ItemId values that you stored. You will have to make individual requests for each ItemID.

  4. Store the returned Work Order Parts data in your data lake for processing.

API requests

Find Work Orders with a PartCost value greater than 0 and a DateCompleted in specified range

 

Request URI: GET /v2/workorders/quicksearches

 

Request Body

Copy
{
    "PartCost": {
        "Filters": [
            {
                "Value": 0.0,
                "MatchType": "IsGreaterThan",
                "SortDescending": false,
                "SortByIndex": -1,
                "ValueIsSet": true
            }
        ]
    },
    "DateCompleted": {
        "StartValue": "2020-11-08T05:00:00",
        "EndValue": "2020-11-14T05:00:00"
    }
}

 

Response Body (Some data omitted for clarity)

Copy
{
    "Items": [
        {
            "WOPartId": 1,
            "WorkOrderId": 2,
            "PartId": 1,
            "Name": "Lithium Grease",
            "DateUsed": "2020-11-09T09:49:30.91",
            "Quantity": 1.0,
            "CostPerUnit": 8.99,
            "LocationId": 3,
            "LocationName": "Storage Locker 1",
            "LocationSiteId": 1,
            "LocationSiteName": "Assembly Plant",
            "UnitName": "each",
            "Extended": 8.99,
            "UsageType": 1,
            "CostCenterId": 1,
            "CostCenterName": "Manufacturing",
            "SourceLocationId": 4,
            "SourceLocationNo": "0000000004",
            "SourceLocationName": "In-feed",
            "StoragePath": "",
            "SourceAssetId": 1,
            "SourceAssetName": "In-feed Roller",
        }
    ]
}

GET Work Order Parts data from identified Work Orders

Request URI: GET /v2/workorders/{{ItemID}}/woparts

 

Response Body (Some data omitted for clarity)

Copy
{
    "Items": [
        {
            "WOPartId": 1,
            "WorkOrderId": 2,
            "PartId": 1,
            "Name": "Lithium Grease",
            "DateUsed": "2020-11-09T09:49:30.91",
            "Quantity": 1.0,
            "CostPerUnit": 8.99,
            "LocationId": 3,
            "LocationName": "Storage Locker 1",
            "LocationSiteId": 1,
            "LocationSiteName": "Assembly Plant",
            "UnitName": "each",
            "Extended": 8.99,
            "UsageType": 1,
            "CostCenterId": 1,
            "CostCenterName": "Manufacturing",
            "SourceLocationId": 4,
            "SourceLocationNo": "0000000004",
            "SourceLocationName": "In-feed",
            "StoragePath": "",
            "SourceAssetId": 1,
            "SourceAssetName": "In-feed Roller",
        }
    ]
}

 

Updating your external system

The Work Order Parts information can be extracted from the returned JSON data. You should include the WorkOrderID value for future reference as it can be useful to tie together multiple data points. You can either store the basic information from the /v2/workorders/quicksearches response or use the same request body with the /workorders/searches endpoint to get full Work Order data.

 

Headers

Authorization

Basic {{ae_token}}

Content-Type

application/json

 

Body

Raw

Copy
{
    "PartCost": {
        "Filters": [
            {
                "Value": 0.0,
                "MatchType": "IsGreaterThan",
                "SortDescending": false,
                "SortByIndex": -1,
                "ValueIsSet": true
            }
        ]
    },
    "DateCompleted": {
        "StartValue": "2020-11-08T05:00:00",
        "EndValue": "2020-11-14T05:00:00"
    }
}

 

Find Work Orders with Part Cost Data - Example Request and Response

Extract Work Order Parts from identified Work Orders - Example Request and Response

 

QuickSearch Work Orders using body filters (POST)

This endpoint is used when you need to identify Work Orders based on filter criteria but do not need to return the complete Work Order object.

 

The /v2/workorders/quicksearch endpoint works the same way that the /v2/workorders/searches endpoint does in regards to body filters but it only returns 3 fields: ItemID, ItemNo and ItemName These three fields are the same as the Work Order fields called WorkOrderID, WONumber and Name.

 

This endpoint is especially useful when you need to identify valid WorkOrderID values for further use like finding labor records, parts costs or completed work orders.

 

Sample Request

Copy
{
    "Page": {
        "PageNumber": 1,
        "PageSize": 200
    },
    "LastModifiedBy": {
        "Filters": [
            {
                "Value": "Tool User",
                "MatchType": "DoesNotContain"
            }
        ]
    },
    "DateLastModified": {
        "StartValue": "2021-02-08T16:00:00",
        "EndValue": "2021-02-08T16:30:00"
    }
}

 

Sample Response

Copy
{
    "PreviousPage": [],
    "CurrentPage": [
        {
            "ItemId": "2",
            "ItemNo": "0000000002",
            "ItemName": "Roller de-greasing"
        }
    ],
    "NextPage": [],
    "TotalItems": 1,
    "TotalPages": 1,
    "PageNumber": 1,
    "PageSize": 20
}

 

Headers

Content-Type

application/json

Authorization

Basic {{ae_token}}

 

Body

Raw

Copy
{
    "PartCost": {
        "Filters": [
            {
                "Value": 0.0,
                "MatchType": "IsGreaterThan",
                "SortDescending": false,
                "SortByIndex": -1,
                "ValueIsSet": true
            }
        ]
    },
    "DateCompleted": {
        "StartValue": "2020-11-08T05:00:00",
        "EndValue": "2020-11-14T05:00:00"
    }
}

 

QuickSearch Work Orders Using Body Filters - Example Request and Response

 

Add Asset Work Order (POST)

Copy
{{AE_URL}}/v2/workorders

Asset work orders, like the name implies, requires that an asset identifier be included in the API Request body. You will need to know the Asset Essentials AssetID value in order to create such a Work Order.

Scenario

You have an external system that is used for asset assessments and corrective maintenance flagged in this application needs to create Work Orders in Asset Essentials.

Business Requirements

  • Only certain asset categories are part of the external assessment system and need to have Work Orders created in Asset Essentials.

  • These assets are created in the external system and use an existing integration to create them in Asset Essentials. At the time of creation the AssetCategory and CustomField values are set and the returned AssetID is stored in the external system for future reference.

  • The CustomField value in Asset Essentials is the external system's asset identification value for reference.

Data Requirements

You will need the following IDs as the minimum required. More data would be advisable:

  • SourceType - The focus of the work order being created. Types are Site, Location, Asset or MeterTitle. See initial API documentation for valid IDs.

  • WOStatusID - Status of the work order. Valid WOStatusID values can be retrieved from /wostatuses.

  • Name - String value that shows up as the Title field in the GUI.

  • WorkRequested - String value that shows up as the Work Requested field in the GUI.

  • AssetID - The ID of the location being targeted for the work order. AssetIDs be retrieved from /Assets if unknown.

  • OriginType - Indicates whether the work order is PM on Non PM based. See Special notes in general Work Order section for valid IDs. If you make the Work Order Non-PM then you will also need to specify the OriginUserID value. If the OriginType field is not sent, the Work Order is defaulted to PM based.

  • OriginUserID - The ID of the user creating the Work Order. Should be the ID of the API access account. Can be found in the GUI or from /users/current endpoint. This is a required field for Non-PM Work Orders.

  • UserIds - Work Orders must be assigned to a worker. You can assign single or multiple workers to a Work Order. "UserIds": "5" for single workers or "UserIds": "5,6" for multiple workers.

Workflow

  1. Identify the required data from Asset Essentials and your external system and construct an appropriate request body.

  2. POST a request to /v2/workorders with the request body constructed with the appropriate data from your external system.

  3. Store the required information from the API Response body in your external system. At a minimum you will need the WorkOrderID value for future reference.

 

API Request

Request URI: POST /v2/workorders

 

Request Body

Copy
{
    "OriginUserId": 7,
    "SourceType": 3,
    "WorkRequested": "Find the leak and fix it.  This is the third time this has happened so see if we can do anything to protect it in the future",
    "WOStatusId": 3,
    "EstimatedCost": 400.0,
    "EstimatedHours": 2.0,
    "Downtime": 1,
    "Name": "HVAC return leak",
    "WOTypeId": 10,
    "WorkTypeId": 9,
    "WorkCategoryId": 10,
    "SourceAssets": [
        {
            "AssetId": 2
        }
    ],
    "UserIds": "5",
    "PriorityId": 2,
    "ProblemId": 9,
    "CauseId": 1,
    "CostCenterId": 1,
    "CustomFields": [
        {
            "Name": "ExternalSystemID",
            "Value": "21252"
        }
    ]
}

 

API Response (Some data omitted for clarity)

Copy
{
    "WorkOrderId": 15,
    "LastModifiedBy": "Tool User",
    "LastModifiedOn": "2021-04-09T11:54:34.19",
    "CreatedBy": "Tool User",
    "CreatedOn": "2021-04-09T11:54:34",
    "SourceType": 3,
    "OriginSourceAssetIds": "2",
    "OriginType": 1,
    "DateOriginated": "2021-04-09T11:54:00",
    "DateAssigned": "2021-04-09T11:54:00",
    "EstimatedHours": 0.0,
    "EstimatedCost": 400.0,
    "Downtime": 1.0,
    "Name": "HVAC return leak",
    "WorkOrderNo": "0000000014",
    "WorkRequested": "Find the leak and fix it.  This is the third time this has happened so see if we can do anything to protect it in the future",
    "WOStatusId": 3,
    "WOStatusName": "In Progress",
    "WOTypeId": 10,
    "WOTypeName": "HVAC",
    "WorkTypeId": 9,
    "WorkTypeName": "Breakdown Maintenance",
    "WorkCategoryId": 10,
    "WorkCategoryName": "HVAC",
    "PriorityId": 2,
    "PriorityName": "High",
    "ProblemId": 9,
    "ProblemName": "Leak",
    "CauseId": 1,
    "CauseName": "Accidental Damage",
    "CostCenterId": 1,
    "CostCenterNo": "000001",
    "CostCenterName": "Manufacturing",
}

 

Headers

Content-Type

application/json

Authorization

Basic {{ae_token}}

 

Body

Raw

Copy
{
    "SourceType": 3,
    "OriginType": 1,
    "OriginUserID": 7,
    "WorkRequested": "Find the leak and fix it.  This is the third time this has happened so see if we can do anything to protect it in the future",
    "WOStatusId": 3,
    "EstimatedCost": 400.0,
    "EstimatedHours": 2.0,
    "Downtime": 1,
    "Name": "HVAC return leak",
    "WOTypeId": 10,
    "WorkTypeId": 9,
    "WorkCategoryId": 10,
    "SourceAssets": [
        {
            "AssetId": 2
        }
    ],
    "UserIds": "5,6",
    "PriorityId": 2,
    "ProblemId": 9,
    "CauseId": 1,
    "CostCenterId": 1,
    "CustomFields": [
        {
            "Name": "ExternalSystemID",
            "Value": "21252"
        }
    ]
}

 

Add Asset Work Order - Example Request and Response

 

Full Work Order Update (PUT)

Copy
{{AE_URL}}/workorders/20

 

When updating an object using the PUT method you have two options for how you update the associated fields. Both are related to the fields that are received (FieldsUpdate) in response data and sent (FieldsToUpdate) with a request.

 

The FieldsUpdate values are a list of the fields of an object that can be updated, while the FieldsToUpdate values are an explicit list of fields that you want to update. By default if the FieldsToUpdate field is not sent, its value is assumed to be NULL and option 2 is enforced.

 

WorkOrder FieldsUpdate sample:

Copy
"FieldsUpdate": [
    "Name",
    "WorkOrderNo",
    "WOStatusId",
    "WOTypeId",
    "WorkCategoryId",
    "WorkTypeId",
    "PriorityId",
],

 

Option 1: Include the FieldsToUpdate Key:value pair with an array of values

When an array of values is included with the FieldsToUpdate key, the API uses this list to limit updates to the specified fields. It is assumed that any field names not included in this array will not be subject to updates even if they are included in the request body. The syntax for the FieldsToUpdate field follows normal JSON array notation.

Copy
{
        "Description": "Electrical panel will not lock",
        "Note": "Panel J21 - key spins and does not turn the locking mechanism",
        "WOStatusId": 1,
        "FieldsToUpdate": ["Description", "Note"]
    }

 

Option 2: Do not include the FieldsToUpdate Key:Value pair or send with a NULL value

When no FieldsToUpdate values are sent in a request, all fields are assumed to be updated. If a field's Key:Value pair is not returned, or that value is empty, the original value will be replaced with a empty value. In this case you must capture and/or store all field values either upon object creation, or prior to an update request, and send those values back along with the altered Key:Value pair. Failure to send back existing field values will result in the loss of object data.

 

Headers

Content-Type

application/json

Authorization

Basic {{ae_token}}

 

Body

Raw

Copy
{
    "OriginUserId": 7,
    "WorkOrderNo": "0000000019",
    "SourceType": 3,
    "OriginSourceType": 3,
    "OriginSourceAssetIds": "2",
    "OriginType": 1,
    "EstimatedCost": 400.0,
    "Downtime": 1.0,
    "Name": "HVAC return leak",
    "WorkRequested": "Find the leak and fix it.  This is the third time this has happened so see if we can do anything to protect it in the future",
    "WOStatusId": 3,
    "DateOriginated": "2021-04-09T14:06:00",
    "DateAssigned": "2021-04-09T14:06:00",
    "WOStatusCategory": 4,
    "WOTypeId": 10,
    "WorkTypeId": 9,
    "WorkCategoryId": 10,
    "PriorityId": 2,
    "PriorityName": "High",
    "ProblemId": 9,
    "CauseId": 1,
    "CostCenterId": 1,
    "SourceAssetId": 2,
    "SourceLocationId": 4,
    "SourceSiteId": 1,
    "SourceSiteNo": "1",
    "SourceAssetIds": "2"
}

 

Full Work Order Update - Example Request and Response

 

Partial Update Work Order (PUT)

Copy
{{AE_URL}}/workorders/10

Updating Objects (PUT method)

When updating an object using the PUT method you have two options for how you update the associated fields. Both are related to the fields that are received (FieldsUpdate) in response data and sent (FieldsToUpdate) with a request.

 

The FieldsUpdate values are a list of the fields of an object that can be updated, while the FieldsToUpdate values are an explicit list of fields that you want to update. By default if the FieldsToUpdate field is not sent, its value is assumed to be NULL and option 2 is enforced.

 

WorkOrder FieldsUpdate sample:

Copy
"FieldsUpdate": [
    "Name",
    "WorkOrderNo",
    "WOStatusId",
    "WOTypeId",
    "WorkCategoryId",
    "WorkTypeId",
    "PriorityId",
],

 

Option 1: Include the FieldsToUpdate Key:value pair with an array of values

When an array of values is included with the FieldsToUpdate key, the API uses this list to limit updates to the specified fields. It is assumed that any field names not included in this array will not be subject to updates even if they are included in the request body. The syntax for the FieldsToUpdate field follows normal JSON array notation.

Copy
{
        "Description": "Electrical panel will not lock",
        "Note": "Panel J21 - key spins and does not turn the locking mechanism",
        "WOStatusId": 1,
        "FieldsToUpdate": ["Description", "Note"]
    }

 

Option 2: Do not include the FieldsToUpdate Key:Value pair or send with a NULL value

When no FieldsToUpdate values are sent in a request, all fields are assumed to be updated. If a field's Key:Value pair is not returned, or that value is empty, the original value will be replaced with a empty value. In this case you must capture and/or store all field values either upon object creation, or prior to an update request, and send those values back along with the altered Key:Value pair. Failure to send back existing field values will result in the loss of object data.

 

Headers

Content-Type

application/json

Authorization

Basic {{ae_token}}

 

Body

Raw

Copy
{
    "WOStatusId": 4,
    "EstimatedCost": 500.0,
    "EstimatedHours": 5.0,
    "Downtime": 2,
    "Name": "HVAC Leak",
    "CustomFields": [
    {
        "Name": "External Site ID",
        "Value": "21253"
     }
    ],
    "FieldsToUpdate": ["WOStatusId","EstimatedCost","EstimatedHours","Downtime","Name","CustomFields"]
}

 

Partial Update Work Order - Example Request and Response

 

Example Response - This request does not return any response body

 

Purchase Orders

Usage

The /purchaseorders endpoint allows you to interact with purchase order data in Asset Essentials. You can manage the full purchase order lifecycle through the API or tap into it to use in conjunction with an external system

 

Supported Methods

GET

You can perform a bulk GET request to return all purchase orders in Asset Essentials or specify a PurchaseOrderId to return data on a specific purchase order. The syntax for spedifying an ID is /purchaseorders/{ID}. You can use a filter parameter to limit the returned data of a bulk GET request. See the Special Notes section for more details.

POST

POST requests allow you to create new purchase order objects. You will need to include extra IDs from other endpoints like /postatuses, /costcenters and others when constructing a new purchase order object.

PUT

PUT requests allow you to update existing purchase orders. The most common update is to POStatusId to manage a purchase order's lifecycle. The following fields are required:

  • PurchaseOrderNumber: Number that is displayed in the Asset Essentials GUI

  • PurchaseOrderID: Internal ID that is automatically set when a purchase order is created.

  • PoStatusId: The internal ID of the purchase order that governs internal automatic actions in Asset Essentials. There may be automatic actions taken as part of your Asset Essentials configuration for purchase orders like line items being added to inventory counts when a purchase order is marked as received.

DELETE

To delete a purchase order you pass the PurchaseOrderID value as a parameter on the request URI. DELETE /purchasorders/{{ID}}

Special Notes

Filters: The /purchaseorders endpoint does not have a search resource but you can use a filter parameter to restrict a GET request based on a single value. For example you could fine all purchase orders that have a particular POStatusName value that matches your unordered status. You would construct this GET request like this: /purchaseorders?filter=POStatusName='PO Arrived'. You can also use != for does not equal with filters.

 

You will normally have a PO Recieved status that has automatic inventory update checked. If you want to move purchase orders directly to completed you will need to set that status to perform automatic inventory updates so your received items update inventory counts.

Workflow for basic Purchase Order lifecycle

  1. Create Purchase Order in Asset Essentials and add line items

  2. GET purchase orders through the /purchaseorders endpoint using ?filter=POStatusID= along with your appropriate ID for new purchase orders.

  3. GET purchase order line items through /purchaseorders/{ID}/poitems for every purchase order ID that you retrieved from /purchaseorders in the previous step. Each line item will be listed as a separate object in the returned JSON data.

  4. Issue purchase order to supplier in external system and update the purchase order status in Asset Essentials. Use PUT to update the purchase order through /purchaseorders/{ID}. Update the PoStatusId to the appropriate ID for the issuing of purchase orders so your Asset Essentials staff know they have been ordered.

  5. Process purchase order through its lifecycle in the external system to completion and then update the POStatusID through /purchaseorders/{ID} to indicate that it has been received. Line items are marked as dispatched and inventory is updated.

  6. Use PUT request to /purchaseorders/{ID} to update the PoStatusId to the appropriate ID for completed purchase orders once it is completed in the external system.

 

Retrieve Purchase Orders and Line Items (GET)

Copy
{{AE_URL}}/purchaseorders?filter=POStatusId=9 AND LastModifiedOn>=%28%232021-03-11T00:00:00%23%29

Scenario

Purchase Orders created in Asset Essentials have to be processed through an external purchasing system and then be pushed back to Asset Essentials to complete them out and dispatch the line items. You need to start with synchronizing new Purchase Orders from Asset Essentials into your external system.

Business Requirements

You need to synchronize all of the PO information as well as the line item information along with supplier information for new Purchase Orders.

Data Requirements

  • The Asset Essentials POStatusID for new Purchase orders.

  • The last synchronization date and time for request filter construction.

 

Endpoints for required data:

  • /purchaseorders - lists all Purchase Orders in Asset Essentials. Use a filter parameter to retrieve only Purchase Orders that have the appropriate status.

  • /purchaseorders/{ID}/poitems - lists all line items associated with the PurchaseOrderId {ID} provided.

  • /postatuses - lists all of the possible Purchase Order statuses set up in your in Asset Essentials instance. You will need the POStatusID value for new Purchase Orders.

Workflow

  1. GET purchase orders through the /purchaseorders endpoint using ?filter=POStatusID= along with your appropriate ID for new purchase orders along with the last synchronization timestamp.

  2. GET purchase order line items through /purchaseorders/{ID}/poitems for every purchase order ID that you retrieved from /purchaseorders in the previous step. Each line item will be listed as a separate object in the returned JSON data.

API requests and responses

The /purchaseorders endpoint does not have a dedicated search resources so you have to use query parameter filters to identify the new Purchase Orders. You will use both the potatusid and LastModifiedOn fields for filtering. Please see the AE API Usage Guide introduction for information on query parameter filtering.

 

API Request

Request URI: GET /purchaseorders?filter=postatusid=9 AND LastModifiedOn>=%28%232021-03-11T00:00:00%23%29

 

Request Body: There is no body required for this API request.

 

 

You note the "PurchaseOrderID": 5 key pair so that you can look up the line items belonging to this Purchase Order and use the necessary data from the response body to create the Purchase Order in your external system.

 

Purchase Order line items

Using the previously returned PurchaseOrderID value, you request a list of all line items belonging to that Purchase Order.

API Request

Request URI: POST /purchaseorders/5/poitems

 

Headers

Authorization

Basic {{ae_token}}

Content-Type

application/json

 

Params

Filter

POStatusId=9 AND LastModifiedOn>=%28%232021-03-11T00:00:00%23%29

 

Get Purchase Orders (filtered) - Example Request and Response

 

Update Purchase Order (PUT)

Copy
{{AE_URL}}/purchaseorders/9

Scenario

Updates to Purchase Orders made in your external system needs to be made in Asset Essentials.

Business Requirements

As the Purchase Order's status changes in your external system, the same status changes need to be made in Asset Essentials so that users can be kept up to date and tracked purchased can be automatically received into inventory within the application.

Data Requirements

  • Your have an existing Purchase Order integration between your external system and Asset Essentials so you already have the bulk of the required data for updating Purchase Orders.

  • You will need to know the POStatusID values from the /postatuses endpoint so you can update the Purchase Orders in Asset Essentials.

  • You will need to update the Purchase Order POStatusID values as they change in your external system. You have identified the following IDs

ID Name
9 New PO
10 PO Issued
11 PO Arrived
12 PO Cancelled
13 PO Received
14 PO Complete
15 PO Archived

 

Special Note: Purchase Orders normally have a lifecycle of statuses and will work through the lifecycle through status changes. Each status will have other status IDs that come before and after it and you should make these incremental changes in status in order for the system to work correctly and have inventory automatically received.

Workflow

Monitor your external system for changes to Purchase Orders.

Update the Purchase Order line items to update their status through their lifecycle.

API Requests

IssuedChange Purchase Order stats to PO Preceding POStatusID is (9 - New PO)

 

Request URI: PUT /purchaseorders/{{ID}}

 

Request Body

Copy
{
    "POStatusID": 10,
    "PurchaseOrderNo": "0000000006",
    "PurchaseOrderID": 6,
    "FieldsToUpdate": ["POStatusID"]
}

 

Further status changes

For each status change in your external system that matches a status in Asset Essentials, send the same Request body and simply change the POStatusID value as required. As you work through the Purchase Order lifecycle the line items will be updated to show their status such as Quantity on Order and Quantity on Hand.

Additional Purchase Order changes

You can change other data in your Purchase Order as needed such as suppliers, storage locations and line items. You will need to identify the additional Asset Essentials endpoints and data that will be necessary for any such updates.

 

Headers

Authorization

Basic {{ae_token}}

Content-Type

application/json

 

Body

Raw

Copy
{
    "POStatusId": 14,
    "PurchaseOrderNo": "0000000009",
    "PurchaseOrderID": 9,
    "FieldsToUpdate": [
        "POStatusId"
    ]
}

 

Update Purchase Order - Example Request and Response

 

Assets

Usage

The /assets endpoint allows you to interact with Asset date in Asset Essentials. This ranges from creating and updating Assets to adding meter readings by using the related /metertitles endpoint.

Supported Methods

GET

You can perform a bulk or single item lookup on the /assets endpoint by either omitting (bulk) or sending the ID /asset/{{ID}} value of a known Asset. You can use filter parameters with a bulk get to limit the objects returned in the response data. Full details on URI filter parameters are available in the API overview section.

POST

POST requests to /v2/assets can be used to create new assets. While you can make a new asset with minimal data, you should pull in relevant extra endpoint ID values so that you have meaningful asset data. You can see examples of recommended endpoints to gather IDs from in the Adding Assets examples. You can also POST to /v2/assets/searches and /v2/assets/searchesids to perform more complex request filtering on Assets then you can with URI parameter filters on the /assets endpoint.

PUT

PUT requests allow you to update existing Assets as necessary. You can use either the full field update method or the "FieldsToUpdate" collection method when updating assets. In most cases the FieldsToUpdate method will be faster and easier.

DELETE

You can DELETE an asset by passing the AssetID value to the \assets endpoint like \assets\{{ID}}.

 

Batch Add Asset (POST)

Scenario

You have an external system that managed your asset inventory and you want existing assets to be added to Asset Essentials in bulk for an initial data load.

Business Requirements

The external system is the system of record for your assets but does not support the creation and tracking of Work Orders. You will use Asset Essentials for all of your Asset Work Orders but in order to do that you need your assets to be entered there. You will use this integration to create all of your initial assets in Asset Essentials and then add new ones as they are created in the external system.

Data Requirements

Many endpoints will be required to create an asset record in Asset Essentials. Below is a list of the suggested endpoints to pull IDs from but not all of them are required depending on your site configuration.

  • SiteID - Sets the site where the asset is located. Sites can be pulled from the /sites endpoint.

  • LocationID - Sets the location where the asset is located. Can send just Location and not Site as locations are below sites in hierarchy. Locations can be puled from the /locations endpoint.

  • CategoryID - Category that the asset belongs to. Categories can be retrieved from the /categories endpoint.

  • AssetStatusID - The current status of the Asset. Statuses can be retrieved from the /assetstatuses endpoint.

  • AssetConditionID - The current condition of the asset. Conditions can be retrieved from the /assetconditions endpoint.

  • SupplierId - The supplier of the asset. Suppliers can be retrieved from the /suppliers endpoint.

Workflow

  1. Identify all of the necessary Asset Essential IDs and Asset data from your external system and construct the request body.

  2. Send an API request to the asset batch endpoint at /assets/batch

  3. Retrieve the AssetID value from the API response and store it in your external system for future reference.

API Request

Batch requests are made as a collection of asset objects.

Request URI: POST /assets/batch

Request body

 

Response Body (some data omitted for clarity)

 

Headers

Authorization

Basic {{ae_token}}

Content-Type

application/json

 

Body

 

Batch Add Asset - Example Request and Response

 

Add a Single Asset (POST)

Copy
{{AE_URL}}/assets

Scenario

You have an external system that managed your asset inventory and you want new assets created there to be added to Asset Essentials automatically. You have already bulk loaded the existing assets into Asset Essentials and this is used to keep your asset information synchronized between the two systems when you add a new asset.

Business Requirements

The external system is the system of record for your assets but does not support the creation and tracking of Work Orders. You will use Asset Essentials for all of your Asset Work Orders but in order to do that you need your assets to be entered there. You will use this integration to create all of your initial assets in Asset Essentials and then add new ones as they are created in the external system.

Data Requirements

Many endpoints will be required to create an asset record in Asset Essentials. Below is a list of the suggested endpoints to pull IDs from but not all of them are required depending on your site configuration.

  • SiteID - Sets the site where the asset is located. Sites can be pulled from the /sites endpoint.

  • LocationID - Sets the location where the asset is located. Can send just Location and not Site as locations are below sites in hierarchy. Locations can be puled from the /locations endpoint.

  • CategoryID - Category that the asset belongs to. Categories can be retrieved from the /categories endpoint.

  • AssetStatusID - The current status of the Asset. Statuses can be retrieved from the /assetstatuses endpoint.

  • AssetConditionID - The current condition of the asset. Conditions can be retrieved from the /assetconditions endpoint.

  • SupplierId - The supplier of the asset. Suppliers can be retrieved from the /suppliers endpoint.

WorkFlow

  1. Identify a new asset added to your external system.

  2. Identify required IDs from Asset Essentials and asset data from your external system.

  3. Construct asset request body and send to /assets endpoint.

API Request

Request URI: POST /assets

 

Request Body

Copy
{
    "Name": "Drill Press #5",
    "SerialNo": "52094564959",
    "Make": "King",
    "Model": "D4506e",
    "PurchasePrice": 500.0,
    "PurchaseDate": "2019-12-18",
    "LifeTime": 20.0,
    "ReplacementCost": 500.0,
    "SalvageValue": 200.00,
    "WarrantyExpirationDate": "2025-12-18",
    "SiteId": 1,
    "CategoryId": 9,
    "CostCenterId": 1,
    "LocationId": 5,
    "AssetStatusId": 1,
    "AssetConditionId": 1,
    "CriticalityId": null,
    "SupplierId": 1,
    "Note": "Drill Press for station 5",
    "AssessmentNote": "Brand new mint condition",
    "WarrantyNote": "Warranty covers workmanship and parts, 1 year of labor",
    "Description": "King pedestal drill press"
}

 

Response Body (Some data omitted for clarity)

Response data from single asset additions return more complete data like the names associated with IDs then is returned with the /assets/batch endpoint.

Copy
{
    "AssetId": 7,
    "Name": "Drill Press #5",
    "AssetNo": "0000000007",
    "SerialNo": "52094564959",
    "Make": "King",
    "Model": "D4506e",
    "PurchasePrice": 500,
    "SiteId": 1,
    "SiteName": "Assembly Plant",
    "CategoryId": 9,
    "CategoryName": "Production",
    "CostCenterId": 1,
    "CostCenterName": "Manufacturing",
    "LocationId": 5,
    "LocationName": "Assembly Station 1",
    "LocationPath": "Line 1\\Assembly Station 1",
    "Path": "Drill Press #5",
    "AssetStatusId": 1,
    "AssetStatusName": "Initial",
    "AssetConditionId": 1,
    "AssetConditionName": "Excellent",
    "SupplierId": 1,
    "SupplierNo": "000001",
    "SupplierName": "Rollers Inc",
    "ParentLocationId": 1,
    "ParentLocationName": "Line 1",
    "Note": "Drill Press for station 5",
    "AssessmentNote": "Brand new mint condition",
    "WarrantyNote": "Warranty covers workmanship and parts, 1 year of labor",
    "Description": "King pedestal drill press",
    "CustomFields": [
        {
            "Name": " ExternalSystemID",
            "Value": "",
        }
    ],
}

 

Headers

Authorization

Basic {{ae_token}}

Content-Type

application/json

 

Body

Raw

Copy
{
    "Name": "Drill Press #5",
    "SerialNo": "52094564959",
    "Make": "King",
    "Model": "D4506e",
    "PurchasePrice": 500.0,
    "PurchaseDate": "2019-12-18",
    "LifeTime": 20.0,
    "ReplacementCost": 500.0,
    "SalvageValue": 200.00,
    "WarrantyExpirationDate": "2025-12-18",
    "SiteId": 1,
    "CategoryId": 9,
    "CostCenterId": 1,
    "LocationId": 5,
    "AssetStatusId": 1,
    "AssetConditionId": 1,
    "CriticalityId": null,
    "SupplierId": 1,
    "Note": "Drill Press for station 5",
    "AssessmentNote": "Brand new mint condition",
    "WarrantyNote": "Warranty covers workmanship and parts, 1 year of labor",
    "Description": "King pedestal drill press"
}

 

Add a Single Asset - Example Request and Response

 

Update Asset

Copy
{{AE_URL}}/assets/7

Scenario

You have an external system that is the system of record for your Assets but does not allow you to create work orders. When Assets are updated in the external system you need to update them in Asset Essentials

Business Requirements

You have a limited number of fields that will be updated in your external system so you can use the partial update method with these changes.

You only need to update assets when their status and condition change so you will only be updating the AssetStatusID, AssetConditionID, and the AssessmentNote.

Data Requirements

You have an existing integration for adding new asset records to Asset Essentials so you already have all of the required information. You will be using the IDs from the /assetstatuses and /assetconditions endpoints that you already pull from Asset Essentials.

Workflow

Identify Assets that have changed in the external system.

Construct an API request body with the identified fields and their values

Make a PUT request to the /assets/{{ID}} endpoint where the ID is the AssetID value you have stored. Pass the request body that you had constructed for the change.

API Requests

Request URI: PUT \assets\6

Request Body

Copy
{
    "AssetStatusId": 5,
    "AssetConditionId": 4,
    "AssessmentNote": "Fall damage, not fit for use",
    "FieldsToUpdate": [
        "AssessmentNote",
        "AssetConditionId",
        "AssetStatusId"
    ]
}

 

Response Body (Some data omitted for clarity)

Copy
{
    "AssetId": 7,
    "Name": "Drill Press #5",
    "SerialNo": "52094564959",
    "Make": "King",
    "Model": "D4506e",
    "LifeTime": 20,
    "ReplacementCost": 500,
    "SiteId": 1,
    "SiteName": "Assembly Plant",
    "CategoryId": 9,
    "CategoryName": "Production",
    "LocationId": 5,
    "AssetStatusId": 5,
    "AssetStatusName": "Retired",
    "AssetConditionId": 4,
    "AssetConditionName": "Poor",
    "Note": "Drill Press for station 5",
    "AssessmentNote": "Fall damage, not fit for use",
    "CustomFields": [
        {
            "Name": " ExternalSystemID",
            "Value": "YH7354",
        }
    ],
}

 

Headers

Authorization

Basic {{ae_token}}

Content-Type

application/json

 

Body

Raw

Copy
{
    "AssetStatusId": 5,
    "AssetConditionId": 4,
    "AssessmentNote": "Fall damage, not fit for use",
    "FieldsToUpdate": [
        "AssessmentNote",
        "AssetConditionId",
        "AssetStatusId"
    ]
}

 

Update Asset - Example Request and Response

 

Add Meter Reading to Asset (POST)

Copy
{{AE_URL}}/v2/assets/1/meterreadings

Scenario

You have an external system that monitors asset meters and you need to create meter readings in Asset Essentials based on this monitoring system.

Business Requirements

Your external monitoring system creates meter reading entries for your assets that need to be entered into Asset Essentials. You do not want to manually enter these readings so you will use your existing Middleware application to monitor for new readings in your external system and create the appropriate reading in Asset Essentials.

Data Requirements

You have existing Asset creation and update integrations so you know the bulk of data you need for adding meter readings to Assets in Asset Essentials.

You will need to add Asset Essentials MeterReadings collection returned from /Assets or /v2/assets/searches to the stored asset data in your external system. If you are using /v2/assets/searches then you need to include the "Options" fields with the "PopulateMeterReadings": "True" collection. { "Options": { "PopulateMeterReadings": "True" }, "OTHERFILTERS": "VALUES" }

Workflow

  1. Monitor for new Meter Readings from your monitoring system.

  2. Construct the API Request URI and request body with Asset Essentials data that you are storing for your assets.

  3. Send a POST /v2/assets/{{ID}}/meterreadings request where ID is the AssetID of the related Asset along with the request body that you constructed.

API Request

Request URI: POST /v2/assets/1/meterreadings

Request Body

Copy
{
    "DateRead": "2021-03-30T11:09:00",
    "ValueRead": 8,
    "AssetId": 1,
    "MeterTitleId": 2
}

Response Body

Copy
{
    "FieldsUpdate": [
        "MeterTitleId",
        "AssetId",
        "DateRead",
        "ValueRead"
    ],
    "FieldsRequired": [
        "DateRead",
        "ValueRead"
    ],
    "MeterReadingId": 2,
    "DateRead": "2021-03-30T11:09:00",
    "ValueRead": 8,
    "AssetId": 1,
    "AssetName": "In-feed Roller",
    "AssetNo": "0000000001",
    "MeterTitleId": 2,
    "MeterTitleName": "Roller Run Time",
    "MeterTitleNo": null,
    "ChangedBy": "Tool User",
    "WorkOrderId": null,
    "DateReadHour": 0,
    "DateReadMinute": 0,
    "CorrelationId": null,
    "FieldsToUpdate": null,
    "RowVersion": "00-00-00-00-00-01-23-BC",
    "CustomFields": null,
    "ExceptionMsg": null,
    "IsAdd": false
}

 

Headers

Authorization

Basic {{ae_token}}

Content-Type

application/json

 

Body

Raw

Copy
{
    "DateRead": "2021-03-30T11:09:00",
    "ValueRead": 8,
    "AssetId": 1,
    "MeterTitleId": 2
}

 

Add Meter Reading to Asset - Example Request and Response

 

Get Asset (GET)

Copy
{{AE_URL}}/assets/2

 

If you know the ID of an asset, you can request the Asset information for that single asset. If you need a bulk list of assets you should use the /assets/searches endpoint with additional filtering to narrow down your request.

 

You can find details on /searches filtering in the AE API User Guide introduction.

Headers

Authorization Basic {{ae_token}}
Content-Type application/json

 

Get Asset - Example Request and Response

Example Response Body: This request does not return any response body.