# mos-execution-apis

> Browser and node module for making API requests against [MOS Execution APIs](https://mos-dev1.teslamotors.com/sparqex/api/{version}).

Latest version **0.0.0** (published 2022-03-14) · Apache 2.0 license · 0 weekly downloads

## Install

```sh
npm install mos-execution-apis
pnpm add mos-execution-apis
yarn add mos-execution-apis
bun add mos-execution-apis
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.0 |
| Published | 2022-03-14 |
| First published | 2022-03-14 |
| Weekly downloads | 0 |
| License | Apache 2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 172 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 121 |
| Author | MuleSoft, Inc. |
| Maintainers | staylorpva |
| Keywords | raml-api |

## Links

- npm: https://www.npmjs.com/package/mos-execution-apis
- Repository: https://github.com/mulesoft/raml-client-generator
- Issues: https://github.com/mulesoft/raml-client-generator/issues
- npm.io page: https://npm.io/package/mos-execution-apis

## Dependencies (1)

- [popsicle](https://npm.io/package/popsicle.md) ^0.3.6

## Recent versions

- 0.0.0 (latest) — 2022-03-14

## README

# MOS Execution APIs

Browser and node module for making API requests against [MOS Execution APIs](https://mos-dev1.teslamotors.com/sparqex/api/{version}).

**Please note: This module uses [Popsicle](https://github.com/blakeembrey/popsicle) to make API requests. Promises must be supported or polyfilled on all target environments.**

## Installation

```
npm install mos-execution-apis --save
bower install mos-execution-apis --save
```

## Usage

### Node

```javascript
var MosExecutionApis = require('mos-execution-apis');

var client = new MosExecutionApis();
```

### Browsers

```html
<script src="mos-execution-apis/index.js">

<script>
  var client = new window.MosExecutionApis();
</script>
```

### Options

You can set options when you initialize a client or at any time with the `options` property. You may also override options for a single request by passing an object as the second argument of any request method. For example:

```javascript
var client = new MosExecutionApis({ ... });

client.options = { ... };

client.resource('/').get(null, {
  baseUri: 'http://example.com',
  headers: {
    'Content-Type': 'application/json'
  }
});
```

#### Base URI

You can override the base URI by setting the `baseUri` property, or initializing a client with a base URI. For example:

```javascript
new MosExecutionApis({
  baseUri: 'https://example.com'
});
```

#### Base URI Parameters

If the base URI has parameters inline, you can set them by updating the `baseUriParameters` property. For example:

```javascript
client.options.baseUriParameters.version = 'v1';
```

### Resources

All methods return a HTTP request instance of [Popsicle](https://github.com/blakeembrey/popsicle), which allows the use of promises (and streaming in node).

#### resources.ping

Ping the system.

```js
var resource = client.resources.ping;
```

##### GET

Ping the MOS system to check availability and build details.

```js
resource.get().then(function (res) { ... });
```

#### resources.thing

Create a thing.

```js
var resource = client.resources.thing;
```

##### POST

Create a new serialized production unit on the given Process.

If no Process Flow, Flow version, or Flow Step are given, the default configuration is used for the given part number (and option codes, if applicable).

<br>

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **partnumber** | *required* | `string` | product part number to use for the new unit. Example: "1047031-00-A". |
| **actorname** | *required* | `string` | name of the primary actor (Equipment, User, System) performing the operation |
| **processname** | *required* | `string` | MOS Process on which to create the unit. Example: "BMX". |
| flowname | *optional* | `string` | Process Flow to use for the new unit -- this will over-ride the default Process Flow defined for the given *partnumber*. |
| flowversion | *optional* | `integer` | Process Flow version to use for the new unit -- this will over-ride the default Process Flow version defined for the given *partnumber* (which is necessary for using non-Production flow versions). |
| flowstepname | *optional* | `string` | Process Flow Step to start the new unit on -- this will over-ride the default starting Step defined for this Process. |
| optioncodes | *optional* | `string array` | array of option codes to define the "variable configuration" of the given *partnumber* (e.g. `["TRA1","TR01","BP00"]`).  |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.thing.thingname(thingname)

* **thingname** _string_

Get details for a thing.

```js
var resource = client.resources.thing.thingname(thingname);
```

##### GET

Get details for the given thing.

You can search for existing things using the endpoints below:

* **/thing/search** - search for things with a search term
* **/thing/step/{stepname}** - get all things in a step
* **/part/{partnumber}/things** - get things by part number

```js
resource.get().then(function (res) { ... });
```

#### resources.thing.search

Search for things.

```js
var resource = client.resources.thing.search;
```

##### GET

Search for things using a search term.

<br>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL (e.g., /search?term=battery).

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **term** | *required* | `string` | search term for the thing name and description |

```js
resource.get().then(function (res) { ... });
```

#### resources.thing.sequencedwipparents

Retrieves the sequenced WIP parents

```js
var resource = client.resources.thing.sequencedwipparents;
```

##### GET

Retrieves the sequenced WIP parents.

<br>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL (e.g. /sequencedwipparents?parent=1MN2:1065600-00-B&child=1FS1:1103547-00-A&optiongroups=DRIVE_MODE).

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **parent** | *required* | `string` | parent process and part number |
| **child** | *required* | `string` | child process and part number |
| **optiongroups** | *required* | `string` | the option groups to include option codes for in response |

```js
resource.get().then(function (res) { ... });
```

#### resources.thing.sequencedconsumedchildren

Retrieves the sequenced consumed children

```js
var resource = client.resources.thing.sequencedconsumedchildren;
```

##### GET

Retrieves the sequenced Consumed Children.

<br>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL (e.g. /sequencedconsumedchildren?parent=1MN2:1065600-00-B&child=1FS1:1103547-00-A&optiongroups=DRIVE_MODE).

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **parent** | *required* | `string` | parent process and part number |
| **child** | *required* | `string` | child process and part number |
| **optiongroups** | *required* | `string` | the option groups to include option codes for in response |

```js
resource.get().then(function (res) { ... });
```

#### resources.thing.sequencedwipchildren

Retrieves the sequenced WIP children

```js
var resource = client.resources.thing.sequencedwipchildren;
```

##### GET

Retrieves the sequenced WIP Children.

<br>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL (e.g. /sequencedwipchildren?parent=1MN2:1065600-00-B&child=1FS1:1103547-00-A&optiongroups=DRIVE_MODE).

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **parent** | *required* | `string` | parent process and part number |
| **child** | *required* | `string` | child process and part number |
| **optiongroups** | *required* | `string` | the option groups to include option codes for in response |

```js
resource.get().then(function (res) { ... });
```

#### resources.thing.partoptiontask

Get tasks by part number and option codes.

```js
var resource = client.resources.thing.partoptiontask;
```

##### GET

Fetch the applicable tasks configured for the given part number and option-code rules (if applicable). This API endpoint returns tasks that are defined outside of a Process - instead, they are defined within a Task Collection.

Once you get a task, you can start it and complete it with the endpoints  `/thing/{thingname}/starttask` and `/thing/{thingname}/completetask`, respectively.

<br>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL (e.g., /tasks?processname=BMX).

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **partnumber** | *required* | `string` | product part number (e.g., "1009312-00-E") |
| **taskcollectionname** | *required* | `string` | the task collection in which to search |
| optioncodes | *optional* | `string` | comma-separated list of option codes in a single string, needed for variable configured parts (e.g., "XKCD,MGMT") |

```js
resource.get().then(function (res) { ... });
```

#### resources.thing.step.stepname(stepname)

* **stepname** _string_

Get all things at a step.

```js
var resource = client.resources.thing.step.stepname(stepname);
```

##### GET

Returns all things at the given Step.

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL (e.g., ?slim=true&partnumber=foo).

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| partnumber | *optional* | `string` | part number filter.  |
| slim | *optional* | `boolean` | returns slim version without nc, lot, and audit data. |
| showoptions | *optional* | `boolean` | returns results with thing option codes array. |
| limit | *optional* | `integer` | limits results to this number. Default is 0 no limit. 
| offset | *optional* | `integer` | starting point to return from results. Default 0 from the start of the results. |

```js
resource.get().then(function (res) { ... });
```

#### resources.thing.thingoptioncode

Bulk updates option codes for things.

```js
var resource = client.resources.thing.thingoptioncode;
```

##### PUT

Updates one or more option codes for one or more things.

```js
resource.put().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.process.processname(processname).work

Get or start available work for a process.

```js
var resource = client.resources.process.processname(processname).work;
```

##### GET

Gets available work for this process - i.e., check to see which products need to be made next. This is "card job" oriented - the response returns a list of card jobs that are available for work. Each card job is for a particular part number and available quantity.

The returned card jobs should be ordered by the required in-process time or manually adjusted priority. Automated equipment can safely pick the first card job in the array if only one can be processed.

If the part to be made is a kit part, the element "kitparts" in the response will detail the component parts and quantities that go into making each kit.

#### URL PARAMETERS

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| partnumber | *optional* | `string` | will filter available work by part number |
| flowname | *optional* | `string` | will filter available work by flow |
| flowversion | *optional* | `number` | will filter available work by flow/flow version, if provided |
| limit | *optional* | `number` | Will limit the number of card jobs returned |
| firstjobbypart | *optional* | `boolean` | If true, will only return the first job for each part |

**Start work**: To start work on one of the returned card jobs, you can call to endpoint `POST /process/{processname}/work` to accept work and generate new production things.

```js
resource.get().then(function (res) { ... });
```

##### POST

Start work on a process for a given card job and part number. You can start work on one or many things with this request using the `quantity` field. This call will create new production things and respond with a list of new thing names on which to work. This will also move that card quantity of work from "available" to "inprocess" in the given card job.

**Getting available work**: You can fetch available card job work for a process with the `GET /process/{processname}/work`.

**Finishing work**: Work for a thing is finished when the `PUT /thing/{thingname}/finishthing` is called at the end of its production, which moves it into MMS inventory.

<br>

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **partnumber** | *required* | `string` | will post by part number |
| **cardjobid** | *required* | `integer` | will post by card job ID |
| **quantity** | *required* | `integer` | will post by quantity |
| **actorname** | *required* | `string` | will post by actor name |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.part.partnumber(partnumber).things

Get things by part number.

```js
var resource = client.resources.part.partnumber(partnumber).things;
```

##### GET

Get a list of things in MOS by part number. This list must be limited to a specific date/time range given by the query parameters listed below. The thing list can be filtered further with optional query parameters.

To find which part numbers are made on a particular process, you can use the `GET /process/{id}/part` endpoint.

<br>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL (e.g., /things?state=WIP).

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **createdfrom** | *required* | `datetime` | starting filter range for the thing creation date/time - format is RFC3339 date/time (e.g., "2017-04-01T07:00:00.000Z"). |
| **createdto** | *required* | `datetime` | ending filter range for the thing creation date/time - format is RFC3339 date/time (e.g., "2017-04-01T07:00:00.000Z"). |
| state | *optional* | `string` | thing state to which to filter - possible states include: *WIP* (things in WIP, before consumption), *CONSUMED* (things consumed into a parent), *SCRAP* (things scrapped) |

```js
resource.get().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.get({ ... });
```

* **search** _string_

with valid searchable fields: createdfrom, createdto, state

#### resources.nonconformance

Create a nonconformance for a thing.

```js
var resource = client.resources.nonconformance;
```

##### POST

Create a nonconformance for a given thing (production unit) on a specified Step. If no Step is given, the current Step is assigned.

<br>

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **thingname** | *required* | `string` | unique thing identifier |
| **type** | *required* | `string` | The type of NC to be created. Valid types include: PRODUCT, PROCESS, EQUIPMENT, PART SHORTAGE, IT SYSTEM |
| **symptom** | *required* | `string` | The symptom code observed to create the NC. Valid symptoms include: FAILED, LEAK, LOOSE/NSP, MISSING, NOT TO SPEC, WRONG |
| **stepname** | *required* | `string` | related process step to assign to this NC |
| **processname** | *required* | `string` | process where the NC should be created (as part of a fully-specified process/flow/version/step) - if not given, the current process step is used |
| description | *optional* | `string` | description of the NC to be created |
| taskname | *optional* | `string` | related Task to assign to this NC |
| ownername | *optional* | `string` | related owner to assign to this NC - by default, the creating actor is used |
| parent | *optional* | `string` | related parent NC name to assign to this NC |
| openedby | *optional* | `string` | actor name of the person opening this NC - by default, the creating actor is used |
| stepdown | *optional* | `string` | mark the related step as "DOWN" by passing `"TRUE"` - the default is `"FALSE"` |
| partnumber | *optional* | `string` | related part number to assign to this NC |
| quantity | *optional* | `integer` | related product quantity to assign to this NC - this defaults to 1 |
| flowname | *optional* | `string` | flow where the NC should be created (as part of a fully-specified process/flow/version/step) - if not given, the current process step is used |
| flowversion | *optional* | `string` | flow version where the NC should be created (as part of a fully-specified process/flow/version/step) - if not given, the current process step is used |
| flowstepname | *optional* | `string` | flow step where the NC should be created (as part of a fully-specified process/flow/version/step) - if not given, the current process step is used |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.nonconformance.ncname(ncname)

* **ncname** _string_

Fetch/modify an existing nonconformance.

```js
var resource = client.resources.nonconformance.ncname(ncname);
```

##### GET

Get the nonconformance details for the specified NC.

```js
resource.get().then(function (res) { ... });
```

##### PUT

Update the given nonconformance, i.e., to add or edit an NC action.

<br>

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **type** | *required* | `string` | The type of NC to be created. Valid types include: PRODUCT, PROCESS, EQUIPMENT, PART SHORTAGE, IT SYSTEM |
| **symptom** | *required* | `string` | The symptom code observed to create the NC. Valid symptoms include: FAILED, LEAK, LOOSE/NSP, MISSING, NOT TO SPEC, WRONG |
| **state** | *required* | `string` | nonconformance state - possible values include: OPEN, RESOLVED, CLOSED |
| description | *optional* | `string` | description of the NC to be created |
| quantity | *optional* | `integer` | related product quantity to assign to this NC - this defaults to 1 |
| ncactions | *optional* | `array` | array of NC actions tied to this NC |

```js
resource.put().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.nonconformance.search

Search for nonconformances.

```js
var resource = client.resources.nonconformance.search;
```

##### GET

Search for nonconformances for a given thing, using the query parameters below to filter results.

<br>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL (e.g., /search?thingname=TFR1709300000G&state=OPEN).

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **thingname** | *required* | `string` | unique product thing identifier |
| state | *optional* | `string` | nonconformance state - options are `OPEN`, `CLOSED`, `RESOLVED`. |
| stepname | *optional* | `string` | filter to NCs created at this step |
| stepstate | *optional* | `string` | filter to NCs with the given step state |

```js
resource.get().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.get({ ... });
```

* **search** _string_

with valid searchable fields: thingname, ncstate, stepstate and stepname

#### resources.picklist

Get manual pick items for a route.

```js
var resource = client.resources.picklist;
```

##### GET

Returns manual pick items for a route and actor. Items are auto-accepted by this request and any CardJobs and Cards are set to InProcess/PickScheduled.

If "max to pick" is set for the route step:
* Only that many items will be returned by the call
* Items will be assigned to the actor so that work can be allocated to different operators

<br>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL.

| parameter | type | description |
|:----------|:-----|:------------|
| **actor** | `string` | equipment or operator name |
| **route** | `string` | Route name or route ID. If there are multiple manual route steps in a route, the specific sequence number can be specified with a ".N" at the end of the name, e.g., "HW36-Tote-To-Shipping.2." |

```js
resource.get().then(function (res) { ... });
```

#### resources.picklist.ship

Indicate manual picking is completed for a route.

```js
var resource = client.resources.picklist.ship;
```

##### POST

For manual pick items, indicates the operator has finished picking for this route and is in transit; returns the shipped pick items. Any accepted pick items that were not picked are returned to Released status.

<br>

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
|  **route** | *required* | `string` | currently not a route ID pointing to an entity, this is just an integer representing a numbered route |
|  **actor** | *required* | `string` | actor name |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.picklist.delivery

Get manual items to be delivered for a route.

```js
var resource = client.resources.picklist.delivery;
```

##### GET

Return manual pick items for a route and actor that are In Transit.

<br>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **route** | *required* | `string` | Route name or route ID. If there are multiple manual route steps in a route, the specific sequence number can be specified with a ".N" at the end of the name, e.g., "HW36-Tote-To-Shipping.2." |

```js
resource.get().then(function (res) { ... });
```

#### resources.picklist.deliverforpallet.containertag.containertag(containertag)

* **containertag** _string_

Gets all the child pickitems for the pallet container.

```js
var resource = client.resources.picklist.deliverforpallet.containertag.containertag(containertag);
```

##### GET

Returns manual child pick items for a pallet container having routestep deliverfrompallet. 

<br>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL.

| parameter | type | description |
|:----------|:-----|:------------|
| **containertag** | `string` | pallet container tag |

```js
resource.get().then(function (res) { ... });
```

#### resources.pickitem.pickitemid(pickitemid)

* **pickitemid** _string_

Get information about a pickitem/set its status.

```js
var resource = client.resources.pickitem.pickitemid(pickitemid);
```

##### GET

Return information about an existing pick item by ID.

<br>

Pick item response entity details:

| field | type | description |
|:----------|:-----|:------------|
| id | `number` | unique pick item identifier |
| status | `string` | lifecycle status of the pick item; see picking overview for details |
| route | `id,name,description` | the route for this pick item |
| part | `id,name,description` | the part to be picked |
| containertag | `string` | The container from which to pick. When picking for a job, this is the recommended container based on the source card that was reserved. |
| containerlength | `number` | length of the container |
| containerlengthuom | `string` | length units |
| containerheight | `number` | height of the container |
| containerheightuom | `string` | height units |
| containerwidth | `number` | width of the container |
| containerwidthuom | `string` | width units |
| weight | `number` | weight of the container, including contents |
| containertype | `string` | the name of the container type from which to pick |
| parentcontainertag | `string` | If the container that was picked has a parent container, this is the parent's tag. Used when picking containers onto a pallet. |
| actor | `string` | if the pick item has been assigned to an actor, the actor name |
| quantityrequired | `number` | the original desired quantity to be picked from the card at the destination |
| quantitytopick | `number` | What the actor is being asked to pick. Usually, this is the same as the quantity required, but if the source card has insufficient quantity, equals the quantity in the source card. |
| quantitypicked | `number` | after status progresses to Picked, the quantity that has been picked |
| pickfromlocation | `string` | location name where the source card was identified or container resides |
| sourceslot | `number` | at the pick location, the starting slot where the container can be found |
| sourcenumslot | `number` | at the pick location, the number of slots the container occupies |
| pickedfromlocation | `string` | location name where the pick actually was reported |
| delivertolocation | `string` | location name where container should be delivered |
| deliveredlocation | `string` | location name where the delivery was reported |
| destinationslot | `number` | at the delivery location, the starting slot where the container was delivered |
| destinationnumslot | `number` | at the delivery location, the number of slots the container occupied |
| fullcontainerpick | `boolean` | indicates whether the source card quantity matches destination card quantity |
| lot | `string` | lot code to be transferred to destination from source card |
| maxtopick | `number` | maximum number of items to pick for this pick item, null or 0 means all were released |
| bubbleid | `number` | some equipment requires a unique tag given to a set of pick items |
| orientation | `string` | desired orientation of the container at delivery (values and meaning TBD) |
| isdepalletize | `boolean` | indicates this pick item is picking a pallet to be broken up into totes for destination cards |
| ispalletize | `boolean` | indicates this pick item is putting single-part pallets together from totes |
| isautorelease | `boolean` | indicates this pick item should be auto-released after prior pick item is completed |
| isrepack | `boolean` | indicates this pick item will be broken down into individual boxes |
| unpickable | `boolean` | indicates this pick item will not be used in pick lists, but only to manage state for other screens (e.g., Load/Unload Trailer) |
| picktopallet | `boolean` | indicates this pick item should prompt for the pallet on which it is placed |
| referencenumber | `string` | optional string equipment can send to reference info in their system |
| reason | `string` | optional string equipment can send to indicate why an item was rejected or unaccepted |
| pickedon | `datetime` | date/time the item was picked |
| deliveredon | `datetime` | date/time the item was delivered |
| sourcecardid | `number` | unique identifier of the source (inventory) card that should be/was picked from |
| cardjobid | `number` | unique identifier of the job; can be null for pure container picks |
| asnacknowledge | `number` | 1 if equipment has acknowledged asn (seen begin cycle item) |

```js
resource.get().then(function (res) { ... });
```

##### POST

Update the status of an existing pick item.

The post body indicates which status to which the pick item should be set and includes additional information needed for that status.

<br>

#### Problem Reasons
The following reasons are valid strings in the `reason` field:
 * PartMissing - when the part could not be found
 * ContainerDamaged - when the container specified was damaged
 * NotReachable - the container could not physically be picked
 * WrongRevision - (needs definition)

<br>

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description | relevant to status |
|:----------|:---------|:-----|:------------|:-------------------|
| **status** | *required* | `string` | Accepted, Unaccepted, Rejected, Picked, Unpicked, InTransit, Delivered  | |
| referencenumber | *optional* | `string` | equipment's identifier for this pick item | all |
| **reason** | *required* | `string` | reason why this pick item was rejected/unaccepted | Unaccepted, Rejected |
| actor | *optional* | `string` | the equipment or person taking this action | all |
| **containertag** | *required* | `string` | the label/QR code/RFID of the container picked | Picked |
| quantity | *optional* | `number` | the quantity actually picked from the container | Picked |
| **pickedfromlocation** | *required* | `string` | the name of the location where the container was picked | Picked |
| **deliveredtolocation** | *required* | `string` | the name of the location where the container was delivered | Delivered |
| destinationslot | *optional* | `number` | the starting slot where the container was delivered | Delivered |
| destinationnumslot | *optional* | `number` | the number of slots the container takes up at delivery location | Delivered |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.pickitem.sequence

delivers a sequenced pick item or items

```js
var resource = client.resources.pickitem.sequence;
```

##### PUT

delivers sequenced pick items for the following scenarios:
1) Container with more than one serial --> Fascia
2) Container with one serial --> IP
3) No container --> Battery pack

```js
resource.put().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.pickitem.bycontainerorstack.containertag(containertag)

* **containertag** _string_

Update pick item status by container or stack.

```js
var resource = client.resources.pickitem.bycontainerorstack.containertag(containertag);
```

##### POST

Update the status of an existing pick item by container tag.

The post body indicates which status to which the pick item should be set and includes additional information needed for that status.

<br>

#### Problem Reasons
The following reasons are valid strings in the `reason` field:
 * PartMissing - when the part could not be found
 * ContainerDamaged - when the container specified was damaged
 * NotReachable - the container could not physically be picked
 * WrongRevision - (needs definition)

<br>

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description | relevant to status |
|:----------|:---------|:-----|:------------|:-------------------|
| **status** | *required* | `string` | Accepted, Unaccepted, Rejected, Picked, Unpicked, InTransit, Delivered  | |
| referencenumber | *optional* | `string` | equipment's identifier for this pick item | all |
| **reason** | *required* | `string` | reason why this pick item was rejected/unaccepted | Unaccepted, Rejected |
| actor | *optional* | `string` | the equipment or person taking this action | all |
| **containertag** | *required* | `string` | the label/QR code/RFID of the container picked | Picked |
| quantity | *optional* | `number` | the quantity actually picked from the container | Picked |
| **pickedfromlocation** | *required* | `string` | the name of the location where the container was picked | Picked |
| **deliveredtolocation** | *required* | `string` | the name of the location where the container was delivered | Delivered |
| destinationslot | *optional* | `number` | the starting slot where the container was delivered | Delivered |
| destinationnumslot | *optional* | `number` | the number of slots the container takes up at delivery location | Delivered |
| **containertags** | *optional* | `string` | comma-separated labels/QR codes/RFID of the containers picked | Picked |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.mrb.scrap

Scrap thing. If the location name is sent as a query parameter (?locationname=XXYYX) then a loop will be created if not found for the configured MRB location.

```js
var resource = client.resources.mrb.scrap;
```

##### POST

Scrap can be done either by card ID, thing name, or container tag.
To scrap, at least one (card ID, thing name, container tag) should be provided with a nonconformance object.

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| cardid | *optional* | `number` | card ID to scrap by card |
| thingname | *optional* | `string` | thing name to scrap by thing |
| containertag | *optional* | `string` | optional container tag to scrap by container |
| quantity | *required* | `number` | quantity to be scrapped |
| nc | *required* | `object` |  | required nonconformance object to scrap (refer to nonconformance for object reference)|

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.loop.consume

Consume material from a replenishment loop location.

```js
var resource = client.resources.loop.consume;
```

##### POST

Consume the given inventory material from a "replenishment loop" location. This endpoint allows users to incrementally consume material, based on the given quantity. Another option is to consume an entire replenishment "card" (e.g., a container) using `POST /loop/consume` if the resolution of incremental consumption is not needed.

This consumption drives material replenishment to that location, since MOS uses "pull-based" material replenishment. This API endpoint is meant to be used by automated equipment to enable automated material consumption during production.

*Defining a card location*: Typical use would provide *one* of the following sets of inputs (described below) to uniquely define the card from which material is being consumed.

  * `partnumber` and `locationname`
  * `containertag` (e.g., bar code on a container)
  * `loopid`

<br>

*Technical Detail*: This transaction decrements the inventory quantity from the oldest on-hand card available in the loop. That card is also marked so that `isconsumptioncard=true`. The system will have only one card marked as `isconsumptioncard` at any point in time. Once the on-hand card quantity goes to zero, that card will be released for replenishment.  If the replenishment process requires more than one card to be grouped (Jobsize) then the card will wait in Begin cycle until the jobsize is reached. If the card is a temporary card or end-of-life card, that card will be destroyed, and a replenishment signal will not be sent to the source.

<br>

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **actorname** | *required* | `string` | name of the primary actor (Equipment, User, System) performing the operation |
| **quantity** | *required* | `float` | quantity to consume |
| partnumber | *optional* | `string` | part number to consume, to be used with `locationname` |
| locationname | *optional* | `string` | location name from which to consume, to be used with `partnumber` |
| containertag | *optional* | `string` | unique container tag identifier (e.g., the bar code on the container) |
| loopid | *optional* | `integer` | unique loop ID  |
| consumestack | *optional* | `boolean` | if true and containertag ID's a stack, consume all containers in the stack |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.loop.consumecard

Consume an entire card from a replenishment loop location.

```js
var resource = client.resources.loop.consumecard;
```

##### POST

Consume an entire replenishment "card" from a "replenishment loop" location. This is a way to consume an entire container, as opposed to incrementally tracking consumption via `POST /loop/consume`.

This consumption drives material replenishment to that location, since MOS uses "pull-based" material replenishment. This API endpoint is meant to be used by automated equipment to enable automated material consumption of containers during production.

<br>

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **actorname** | *required* | `string` | name of the primary actor (Equipment, User, System) performing the operation |
| cardid | *optional* | `integer` | material card ID - `containertag` is an alternative input |
| containertag | *optional* | `string` | unique container tag identifier (e.g., the bar code on the container) |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.loop.consumepallet

Consumes an entire pallet with child containers or stacks

```js
var resource = client.resources.loop.consumepallet;
```

##### POST

Consume an entire pallet that has child container(s) or stack(s). This is a way to consume all the stacks at once, as opposed to incrementally tracking stack consumption via `POST /loop/consume`.

<br>

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **actorname** | *required* | `string` | name of the primary actor (Equipment, User, System) performing the operation |
| pallettag | *required* | `string` | unique pallet tag identifier (e.g. the barcode on the pallet) |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.loop.eject

Eject a card onto empty, residual, or MRB route

```js
var resource = client.resources.loop.eject;
```

##### POST

Ejects a container onto one of three routes defined for the loop. The *empty* route is used if the identified
container is attached to an empty card. The *residual* route is used if the card still has material in it. The
*MRB* route is used if the card had MRB reported against it. The card must be in On Hand status.

The container can be identified through any of these parameters

  * `partnumber` and `locationname`
  * `loopid`
  * `containertag` (e.g. barcode on a container)

If the container tag is not provided, the active consumption card on the loop identified by loop id
or partnumber/locationname 

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **actorname** | *required* | `string` | name of the primary actor (Equipment, User, System) performing the operation |
| partnumber | *optional* | `string` | part number to consume, to be used with `locationname` |
| locationname | *optional* | `string` | location name to consume from, to be used with `partnumber` |
| containertag | *optional* | `string` | unique container tag identifier (e.g. the barcode on the container) |
| loopid | *optional* | `integer` | unique loop ID  |
| forceempty | *optional* | `boolean` | will force the container on the empty route |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.loop.createlocationro

Create an RO at a specific location

```js
var resource = client.resources.loop.createlocationro;
```

##### POST

This API will create a replenishment order (RO) at a given location name. It expects there to be one active loop at that location. If there is more than one (e.g. during part pedigree changes) it will use the first one and expect part pedigree logic to pick the correct part. The RO card is returned.

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **locationname** | *required* | `string` | the name of the location where RO should be created |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.loop.loopid(loopid).createro

Creates one or more RO's for a loop ID

```js
var resource = client.resources.loop.loopid(loopid).createro;
```

##### POST

This API will create one or more replenishment orders (RO) in a loop. 

#### BODY PARAMETERS
Body parameters are passed as the POSTed body in the request.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **numcard** | *required* | `number` | The number of RO's to create. |
| priority | *optional* | `boolean` | Set true to make the RO's have priority flag turned on. Default false. |
| mfgordernumber | *optional* | `string` | Only allowed if numcard is 1. Manufacturing order to be associated with the RO |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.loop.locationpartsequence

Returns the sequence of parts to be used at a location

```js
var resource = client.resources.loop.locationpartsequence;
```

##### GET

Returns the sequence of part counts required at a location and step. This API requires a thing to be at the step at the location. If there is no thing at that step then error code 1100 will be returned. The client should call back after a wait period to get new information. Note that prior information is valid until the next takt time as it only changes as each thing enters/exits the step.

The data returned include the current thing name at the location and an array of (PartNumber, LengthOfRun, Quantity) items indicating in order the parts that will be needed at that location for the upcoming manufacturing sequence. The LengthOfRun is the number of things (e.g. vehicles) for that part. Quantity is the number of parts per thing (vehicle) which comes from the BOM.

<br>

#### QUERY PARAMETERS
Query parameters are passed in the URL

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **locationname** | *required* | `string` | Location name where sequence calculation is to be performed. |
| **stepname** | *required* | `string` | Step name where sequence calculation is to be performed, e.g. 1MN1-050. |
| **count** | *required* | `numeric` | Number of things in the manufacturing sequence to examine, e.g. 500 in GA for the next 500 vehicles |

```js
resource.get().then(function (res) { ... });
```

#### resources.loop.setquantity

Sets the absolute quantity on a virtual kanban loop

```js
var resource = client.resources.loop.setquantity;
```

##### POST

Sets the absolute quantity of material in a loop, typically through measuring. The loop must be defined as a Virtual Kanban. The typical sequence of events will be:

 * Start with a permanent on hand card with quantity 100
 * Measurement taken, call SetQuantity with 90; card quantity is adjusted
 * Measurement taken, call SetQuantity with 80; card quantity is adjusted
 * Virtual loop order at quantity is 85, so the system will
   * Convert the existing card to temporary
   * Create a new permanent card that is Released to the supplier
 * Measurement taken, call SetQuantity with 70; temp card quantity is adjusted
 * Measurement taken, call SetQuantity with 60; temp card quantity is adjusted
 * Material arrives, call SetQuantity with 155
   * Released permanent card is put On Hand with quantity 155
   * Temporary card (was QOH 60) is deleted

<br>

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **quantity** | *required* | `float` | absolute quantity now present of this part |
| **partnumber** | *required* | `string` | part number to be set |
| **locationname** | *required* | `string` | location name to be set |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.loop.adjustcounter

Adjusts a countdown loop counter up or down

```js
var resource = client.resources.loop.adjustcounter;
```

##### POST

Adjusts the counter on a loop with type CountDown. Can be used to adjust the counter UP or DOWN. If adjusting down, MOS will reduce the counter to zero and place a replishment order as many times as necessary to use up the entire *delta* provided.

Example:
- Loop card quantity is 15
- Current counter is at 6
- AdjustCounter is called with -25

MOS will reduce the counter from 6 to zero and place one order. The counter gets reset to 15 (card quantity). Then since there is still -19 to apply, the counter is reduced from 15 to zero and another order is placed. The counter will end up at 11 (15 card quantity - 4 remaining from the delta argument.)

The loop can be identified by either
  * `partnumber` and `locationname`
  * `loopid`

If the identified loop is not of type CountDown, an error is returned.

<br>

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **delta** | *required* | `float` | Quantity to adjust the counter by. |
| partnumber | *optional* | `string` | Part number to identify the loop, to be used with `locationname` |
| locationname | *optional* | `string` | Location name to identify the loop, to be used with `partnumber` |
| loopid | *optional* | `integer` | Unique loop ID to identify the loop |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.loop.counter

Gets the current counter for a countdown loop

```js
var resource = client.resources.loop.counter;
```

##### GET

Returns the counter on a loop with type CountDown.

The loop can be identified by either
  * `partnumber` and `locationname`
  * `loopid`

If the identified loop is not of type CountDown, an error is returned.

#### URL PARAMETERS
URL parameters are passed in url in key=value&key2=value2 format

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| partnumber | *optional* | `string` | Part number to identify the loop, to be used with `locationname` |
| locationname | *optional* | `string` | Location name to identify the loop, to be used with `partnumber` |
| loopid | *optional* | `integer` | Unique loop ID to identify the loop |

```js
resource.get().then(function (res) { ... });
```

#### resources.loop.countdowncounters

Gets a filtered list of countdown counters

```js
var resource = client.resources.loop.countdowncounters;
```

##### GET

Returns countdown loop counters filtered by part, location, and site. The parameters are combined together as one filter, e.g. if partnumber and site are provided, only loops with both that part and site will be included.

#### URL PARAMETERS
URL parameters are passed in url in key=value&key2=value2 format

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| partnumber | *optional* | `string` | Part number filter. |
| locationname | *optional* | `string` | Location name filter. |
| site | *optional* | `string` | Site filter. |

```js
resource.get().then(function (res) { ... });
```

#### resources.loop.id(ID).recallablecard

Return all recallable cards for the specified loop.

```js
var resource = client.resources.loop.id(ID).recallablecard;
```

##### GET

Return all recallable cards for a loop.

<br>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **ID** | *required* | `number` | the loop ID |


Fields in a card response include:

| field | type | description |
|:----------|:-----|:------------|
| id | `number` | unique card identifier |
| cycleno | `number` | cycle number, increased every time card goes to the begin cycle |
| loopid | `number` | unique identifier of the card's loop |
| partid | `number` | unique identifier of the card's part |
| partnumber | `string` | Tesla part number held in the card |
| partdescription | `string` | description of the part held in the card |
| label | `string` | current content label or container tag for the card |
| status | `number` | 1=BeginCycle, 2=Released, 3=InProcess, 4=InTransit, 5=AtDock, 6=OnHand, 7=Inspection |
| statustring | `string` | status decoded as a string per above list |
| location | `object` | ID, name, description of the card's current location |
| quantityonhand | `number` | when status = OnHand, the quantity available to be used in the card; for other statuses, this quantity is in process |
| quantityreserved | `number` | quantity that pick items holding reservations have reserved |
| quantityconsumed | `number` | *most recent* quantity consumed (not total) |
| iscurrentconsumption | `boolean` | flag indicating this card is actively being consumed for its loop |
| istemp | `boolean` | flag indicating this card is temporary and will live a number of lives or expire by date |
| lifecount | `number` | how many lives remain for this card, if it is temporary |
| expireson | `datetime` | if not null, date/time this card will be deleted, if it is temporary |
| donotuse | `boolean` | flag indicating there is a problem with this card; set by skipping a pick |
| qchold | `boolean` | flag indicating there is a quality hold on the card |
| unusable | `boolean` | donotuse or qchold |

```js
resource.get().then(function (res) { ... });
```

#### resources.loop.inventoryreport.bytrailer

Returns on-hand inventory report by trailer

```js
var resource = client.resources.loop.inventoryreport.bytrailer;
```

##### GET

Returns on-hand inventory report by trailer

<br>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **ID** | *required* | `number` | the location ID, part ID, or loop ID |
| **type** | *required* | `string` | the 'Location', 'Part', 'Loop', or 'Trailer' |


Fields in the response include:

| field | type | description |
|:----------|:-----|:------------|
| partnumber | `string` | Tesla part number |
| partdescription | `null.String` | The part description |
| cardlocation | `null.String` | The location name for the card |
| locdescription | `null.String` | The description of the location |
| locationtype | `string` | The type of the location |
| availablequantity | `null.Float` | Quantity on-hand summed across all cards |
| cardstatus | `string` | OnHand |
| trailerno | `string` | Trailer the card came from |

```js
resource.get().then(function (res) { ... });
```

#### resources.loop.ryginventoryreport

Returns RYG inventory report by loop, part, location, or trailer

```js
var resource = client.resources.loop.ryginventoryreport;
```

##### GET

Return RYG inventory report by location.

<br>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **ID** | *optional* | `number` | the location ID, part ID, or loop ID |
| **type** | *required* | `string` | the 'Location', 'Part', 'Loop', or 'Trailer' |
| **name** | *optional* | `string` | the trailer number |


Fields in the response include:

| field | type | description |
|:----------|:-----|:------------|
| loopid | `number` | unique identifier of the loop |
| loopname | `string` | name of the loop |
| partid | `number` | unique identifier of the part |
| partnumber | `string` | Tesla part number |
| locname | `string` | The location name for the loop |
| locdesc | `string` | The description of the location |
| partdescription | `string` | The part description |
| locname | `string` | the location name for the loop |
| loopcardquantity | `number` | card quantity defined on the loop |
| cardcount | `number` | number of cards |
| actualonhandqty | `number` | quantity on-hand summed across all cards |
| totalquantity | `number` | total quantity on-hand for the loop, for all cards |
| rygpercentage | `number` | RED, YELLOW, GREEN percentage |
| rygflag | `string` | RED, YELLOW, GREEN status |
| trailerno | `null.String` | The trailer number |

```js
resource.get().then(function (res) { ... });
```

#### resources.loop.materialexpirationreport

Returns material expiration report by site, part, warehouse, zone, or cardid

```js
var resource = client.resources.loop.materialexpirationreport;
```

##### GET

Return material expiration inventory report for parts with shelf life by site/location/part.

<br/>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| site | *required* | `string` | required site name |
| location | *optional* | `string` | optional warehouse or zone name |
| partnumber | *optional* | `string` | optional part number |
| expiresin | *required* | `number` | required expires in days, pass -1 for getting all records |
| yellowlevel | *required* | `number` | optional yellow if expires in n days |
| cardid | *optional* | `number` | optional card id |

```js
resource.get().then(function (res) { ... });
```

#### resources.actor

Get all actors

```js
var resource = client.resources.actor;
```

##### GET

Get all actors provides details on actors, their role, and optionally permisions.

<br>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL (e.g. /actor?includepermission=true&type="actor,equipment").

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| includepermission | optional  | `boolean` | If set to true the permissons will be included in the response.|
| type | optional | `string` | A comma separated list of actor type to include. One or more of user,equipment,system |

```js
resource.get().then(function (res) { ... });
```

#### resources.actor.actor(actor).picklist

Get released actor pick items or Post to autoaccept released items.

```js
var resource = client.resources.actor.actor(actor).picklist;
```

##### GET

Return an array of pick items for the actor, typically a piece of equipment like ASRS or AGV. By default, returns pick items with status Released. This represents the work that the actor is being asked to do.

<br>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL. **NOTE:** only one may be used.

| parameter | type | description |
|:----------|:-----|:------------|
| allactive | `boolean` | if true, return Released, Accepted, Picked, InTransit pick items |
| inprocess | `boolean` | if true, return Accepted, Picked, InTransit pick items |
| mode | `string` | if "asn," return BeginCycle pick items as an "advanced look" at what will be released |

```js
resource.get().then(function (res) { ... });
```

##### POST

Auto accept and return an array of pick items for the actor, typically a piece of equipment like ASRS or AGV. Examine items in Released state for the actor in "time required" order and auto-accept them, up to "max to pick" if that field is non-zero on the route step for each pick item, otherwise all of them.

Items auto-accepted through this API will have a bubble ID assigned to them that represents the group of items. Some equipment (e.g., Dematic) has a special format for the response that is triggered by setting` groupbybubble=true` parameter. Otherwise, the response is an array of pick items.

<br>

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| groupbybubble | optional | `boolean` | special format where pick items are grouped by bubble ID as a numeric |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.actor.actorid(actorid).rolename(rolename)

* **rolename** _string_

Set the role for existing actor by id.

```js
var resource = client.resources.actor.actorid(actorid).rolename(rolename);
```

##### PUT

Set an actor's role.

<br>

#### QUERY PARAMETERS
n/a

```js
resource.put().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.actorpermision.actorid(actorid).permissionshortname(permissionshortname)

* **permissionshortname** _string_

Set a permission for existing actor by id.

```js
var resource = client.resources.actorpermision.actorid(actorid).permissionshortname(permissionshortname);
```

##### POST

Add a permission to an actor by id using the permisson short name (3 characters maximum)


<br>

#### QUERY PARAMETERS
n/a

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

##### DELETE

Delete a permission from an actor by id using the permisson short name (3 characters maximum)
<br>

#### QUERY PARAMETERS
n/a

```js
resource.delete().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.card.id(ID)

* **ID** _string_

Get a card by ID.

```js
var resource = client.resources.card.id(ID);
```

##### GET

Return basic information about a card.

Fields in a card response include:

| field | type | description |
|:----------|:-----|:------------|
| id | `number` | unique card identifier |
| cycleno | `number` | cycle number, increased every time card goes into begin cycle |
| loopid | `number` | unique identifier of the card's loop |
| partid | `number` | unique identifier of the card's part |
| partnumber | `string` | Tesla part number held in the card |
| partdescription | `string` | description of the part held in the card |
| label | `string` | current content label or container tag for the card |
| status | `number` | 1=BeginCycle, 2=Released, 3=InProcess, 4=InTransit, 5=AtDock, 6=OnHand, 7=Inspection |
| statustring | `string` | status decoded as a string per above list |
| location | `object` | ID, name, description of the card's current location |
| quantityonhand | `number` | when status = OnHand, the quantity available to be used in the card; for other statuses, this quantity is In Process |
| quantityreserved | `number` | quantity that pick items holding reservations have reserved |
| quantityconsumed | `number` | *most recent* quantity consumed (not total) |
| iscurrentconsumption | `boolean` | flag indicating this card is actively being consumed for its loop |
| istemp | `boolean` | flag indicating this card is temporary and will live a number of lives or expire by date |
| lifecount | `number` | quantity of lives remaining for this card, if it is temporary |
| expireson | `datetime` | if not null, date/time this card will be deleted, if it is temporary |
| donotuse | `boolean` | flag indicating there is a problem with this card, set by skipping a pick |
| qchold | `boolean` | flag indicating there is a quality hold on the card |
| unusable | `boolean` | donotuse or qchold |

```js
resource.get().then(function (res) { ... });
```

#### resources.card.split

Split quantity from a single card into other containers by container

```js
var resource = client.resources.card.split;
```

##### POST

Splits quantity from an existing on-hand card into multiple containers. The containers cannot be attached to cards, they must be empty.

#### BODY PARAMETERS
The body of split card by container request has the source container and an array of container/quantity objects for the destination containers.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **containertag** | *required* | `string` | the tag of the container to split from |
| **destinations** | *required* | `array` | array of containertag/quantity pairs as per split card |
| allowzero | *optional* | `boolean` | allow quantity on source card to reach zero (default false) |
| allowconsolidate | *optional* | `boolean` | if true, then splitting into a non-empty container (of the same part number) is allowed (default false) |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.card.mrb

Report MRB.

```js
var resource = client.resources.card.mrb;
```

##### POST

MRB can be reported either by card ID, thingname, or container tag.
To create MRB, at least one (cardid, thingname, containertag) should be provided with array of nonconformance object.

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| cardid | *optional* | `number` | card ID to report MRB by card |
| thingname | *optional* | `string` | thing name to report MRB by thing |
| containertag | *optional* | `string` | optional container tag to report MRB by container |
| mrbncs | *required* | `object array` |  | required nonconformance object to report MRB (refer to nonconformance for object reference)|

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.card.lot.bycontainer.containertag(containertag)

* **containertag** _string_

Get a single lot by position in a card using container tag or add a lot.

```js
var resource = client.resources.card.lot.bycontainer.containertag(containertag);
```

##### GET

Return information about a single lot in a card by position.

Lots with no position are ignored in the calculation.

Consider the following lot information:

| lot | position | quantity |
|:----|:--------|:---------|
| L1 | 1 | 5 |
| L2 | 6 | 8 |
| L3 | 20 | 9 |

In this case there is a gap (empty spots on a tray, for example).

A call to get lot by position 4 would return L1. A call with position 18 would return a 404 error since there is no lot at that position.

The parameter *hightolow* allows calculation of lot from the end of the lot positions to the beginning. This is useful when loading lots into a container from the bottom to top and then picking from the top of the container. In the example above, the last position is 28 which would correspond to position 1 when this flag is true. For this example, the following positions would give these results:

| positions | lot |
|:----|:--------|
| 1, 5, 9 | L3 |
| 10, 13, 15 | 404 error |
| 16, 19, 23 | L2 |
| 24, 26, 28 | L1 |


#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **position** | *required* | `number` | 1-relative position to find lot |
| hightolow | *optional* | `boolean` | if true, start from the end of all lot positions |

```js
resource.get().then(function (res) { ... });
```

##### POST

Add a new lot to a card.

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **lot** | *required* | `string` | the lot code of the lot being added |
| **quantity** | *required* | `number` | how many of the lot is being added |
| position | *optional* | `number` | optional position within the container |
| part | *optional* | `object` | either "id" or "partnumber" should be provided |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

##### DELETE

Remove a lot from a card by the lot code and optional position. If position is not given, all instances of that lot code will be removed.

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **lot** | *required* | `string` | the lot code to remove |
| position | *optional* | `number` | 1-relative, always from low to high |

```js
resource.delete().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.card.lots.bycontainertag.containertag(containertag)

* **containertag** _string_

Get all of a card's lots using container tag.

```js
var resource = client.resources.card.lots.bycontainertag.containertag(containertag);
```

##### GET

Return information about the lots in a card. Lot information is stored in the CardThing table with type "LOT." Typically, a lot is of the same part as the card, but it is possible with kitted parts to have lots of different parts. It is also possible to have multiple lots of the same part in a card.

Lot position is an optional field, but can be used to track where this lot starts and ends (using quantity) on a tray or a magazine. Position is 1-relative.

Fields in a card lot include:

| field | type | description |
|:----------|:-----|:------------|
| id | `number` | unique card thing table identifier |
| cardid | `number` | unique card table identifier |
| cycleno | `number` | cycle number; increased every time card goes into begin cycle |
| lot | `string` | the lot code itself |
| part | `object` | ID, part number, description for the lot's part |
| position | `number` | optional 1-relative position where this lot starts |
| quantity | `number` | quantity of this lot in the card or at the position if provided |

```js
resource.get().then(function (res) { ... });
```

#### resources.card.onhandforparts

Return the onhand quantities for all loops associated with a list of part IDs.

```js
var resource = client.resources.card.onhandforparts;
```

##### POST

Accept an array of part IDs as input, and return an array containing all the loops for that part, along with the on-hand quantity for each loop.

| field | type | description |
|:----------|:-----|:------------|
| partid | `number` | unique part ID |
| loopname | `string` | name for a particular loop |
| quantity | `number` | on-hand quantity for this loop |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.card.forloop.id(ID)

* **ID** _string_

Get all the cards for the loop id

```js
var resource = client.resources.card.forloop.id(ID);
```

##### GET

Get Cards for loop returns all the cards associated with that loop. If returnemptyarray is not given and there no cards found for that loop it will return error 404, but if given and set to true it will return 200 with empty cardlist

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| returnemptyarray | *optional* | `boolean` | false by default |

```js
resource.get().then(function (res) { ... });
```

#### resources.card.tag(tag).movetag

Move Inventory by Tag moves material from one location to another location

```js
var resource = client.resources.card.tag(tag).movetag;
```

##### POST

Move Inventory by Tag moves material from one location to another location.

#### URL PARAMETERS
The URL of move inventory by tag request has the container tag as a parameter

**NOTE**: this API requires either location (location name) or location id

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **tag** | *required* | `string` | the container tag from which we get the cards to move |
| location | *optional* | `string` | the destination location name |
| locationid | *optional* | `number` | the destination location id |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.card.polabels

Returns the response with polabels and statuses

```js
var resource = client.resources.card.polabels;
```

##### POST

POLabels enters the information in ASN for printing multiple labels for the same PO, Part, and Quantity.

Validations which return an error:
- Hard DB failure while creating ASN
- Sends status = conflic when the same po, part, quantity for another label was already created, it can be reprocessed by sending forcepolabel = true

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **polabels** | *required* | `array` | Each polabelrequest is {"palletlp":"label", "partnumber":"pn", "po":"ponumber","poline":"linenumber", "quantity":N, "forcepolabel": false} forcepolable is optional and false by default it should only be set to true upon conflict confirmation |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.card.undothingtransfer

Updates the thing to MMS state from transferred

```js
var resource = client.resources.card.undothingtransfer;
```

##### POST

Undo Transfer of thing back to MMS state

#### BODY PARAMETERS
The body of undo transfer has the thing name

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **thingname** | *required* | `string` | thing name to be updated back to MMS state from transferred state |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.card.transfertomes

Transfer tracked or non tracked material to MES

```js
var resource = client.resources.card.transfertomes;
```

##### POST

Transfer tracked and non tracked material to MES

#### BODY PARAMETERS
The body of transfer to MES request has the source container or thing and destination location in MES.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **containertag** | *required* | `string` | the tag of the container to be transferred, optional if thingname is provided |
| **location** | *required* | `string` | location to be transferred to in MES |
| **thingname** | *optional* | `string` | thing name to be transferred |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.container.bytag.containertag(containertag)

* **containertag** _string_

Return basic container information.

```js
var resource = client.resources.container.bytag.containertag(containertag);
```

##### GET

Return basic information about a single container by its unique string tag.

Fields in a container response include:

| field | type | description |
|:----------|:-----|:------------|
| id | `number` | unique container identifier |
| tag | `string` | unique container string identifier |
| currentcontentlabel | `string` | a permanent container (e.g., a tote) can have content like a 1J inside it |
| capacity | `number` | permanent containers like racks can have a capacity of things they can hold |
| istemp | `boolean` | temporary containers are created for pallets and boxes that are handled not in a permanent container and assigned to cards when they begin cycle |
| containertypeid | `number` | unique identifier of the container's type |
| containertypename | `strng` | the container's type name (e.g., P01, T01) |
| istransitcontainer | `boolean` | transit containers are usually truck trailers and indicate that items placed inside them during trailer load are about to go in transit |
| children | `array` | the containers that are children of this container, if the API returns child containers |
| parentcontainerid | `number` | unique ID of the parent of this container |

```js
resource.get().then(function (res) { ... });
```

#### resources.container.containertag(containertag).moveinfo

Return information relevant to moving a container.

```js
var resource = client.resources.container.containertag(containertag).moveinfo;
```

##### GET

Return information about potential move of a container, including whether there is an existing active pick item, any card attached to the container, and potential loops to which the container/card could be moved.

<br>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL. All are required.

| parameter | type | description |
|:----------|:-----|:------------|
| **containertag** | `string` | the container's unique tag |
| **routename** | `string` | route name that should be used to move the container |
| **sourcelocation** | `string` | name of the current location of the container |
| **destinationlocation** | `string` | name of the final destination for the container |
| moveassociatedlp | `boolean` | true if move info has to be stack and parent LP aware |

#### RESPONSE FIELDS
| field | type | description |
|:----------|:-----|:------------|
| containertag | `string` | container tag from request |
| routename | `string` | route name from request |
| sourcelocation | `string` | location from request |
| destinationlocation | `string` | location from request or route final destination if destinationisfixed is true |
| destinationisfixed | `boolean` | true if the route will not permit a destination override |
| card | `Card entity` | full information about the card attached to the container, or null |
| pickitem | `PickItem entity` | full information about the active pick item for the container, or null |
| destinationcardloops | `array of id/name` | if card is not null, list of loops of the card's part at the destination or its zone |
| destinationcontainerloops | `array of id/name` | if card is null, list of loops of the container type's part at the destination or its zone |

```js
resource.get().then(function (res) { ... });
```

#### resources.container.thingunmarry

Unmarry a thing from its container.

```js
var resource = client.resources.container.thingunmarry;
```

##### POST

Unmarry a thing from its current container. If the card thing record is the same cycle as the card and there are no other married things on the card, the card is dissociated from the container and reverts to its default container label.

Thing unmarry is not permitted if thing marry complete has already been run or if the card is on hand.

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **thingname** | *required* | `string` | thing name to be dissociated from its container |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.container.createstack

Create a stack out of a list of container tags

```js
var resource = client.resources.container.createstack;
```

##### POST

Creates a new stack from a list of containers. The POSTed body should be a JSON array of container tags. The response is an array of container objects.

This API does NOT perform "stackcomplete" logic as would be done in the middle of a repack route. It is therefore like making startstack and addtostack calls with containeronly=true parameter.


#### BODY PARAMETERS
The body of the POST should be an array of container tags, e.g. ["03TFR10219829", "03TFR20182819"]

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.container.trailers

Return basic container information for all parent containers of type trailer.

```js
var resource = client.resources.container.trailers;
```

##### GET

Return basic information about all trailers.

```js
resource.get().then(function (res) { ... });
```

#### resources.container.trailersforpart.partnumber(partnumber)

* **partnumber** _string_

Retrieve trailer tags having the given part number.

```js
var resource = client.resources.container.trailersforpart.partnumber(partnumber);
```

##### GET

Return basic information about multiple trailers carrying the given part.

Fields in a response include:

| field | type | description |
|:----------|:-----|:------------|
| trailer | `string` | unique trailer identifier |
| partnumber | `string` | part identifier |
| quantity | `number` | total quantity for the given part on the trailer |

```js
resource.get().then(function (res) { ... });
```

#### resources.container.generatelabel

GenerateUniqueLabel  creates a container with unique tag for label type

```js
var resource = client.resources.container.generatelabel;
```

##### POST

Creates a container with unique tag and Returns the same container.

Actions performed:
- constructs unique label with labeltype (1J/5J/6J) prefix,  warehouse code (if not present default is "MOS"), current time stamp (upto microseconds), and followed by randomly generated int (for precise uniqueness)

Prerequisites:
- labelType needs to be present in the request and labelType can be of type: "Box" / "Homogeneous" / "Heterogeneous", anything else is defaulted to type "Box" 
- There must be pre-existing container type for "Pallet" (it will pick the first containertype for Pallet while creating container)

Validations which return an error:
- If labelType is empty
- If warehouse is invalid
- If container type for type Pallet is not found
- If container exists with the same tag (unlikely though)
- Hard DB error while creating Container

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL; and are required.

| parameter | type | description |
|:----------|:-----|:------------|
| **labeltype** | `string` | label type ("Box" / "Homogeneous" / "Heterogeneous") |
| **warehouse** | `string` | warehouse name |

Fields in a container response include:

| field | type | description |
|:----------|:-----|:------------|
| id | `number` | unique container identifier |
| tag | `string` | unique container string identifier |
| currentcontentlabel | `string` | a permanent container (like a tote) can have content like a 1J inside it |
| capacity | `number` | permanent containers like racks can have a capacity of things they can hold |
| istemp | `boolean` | temporary containers are created for pallets and boxes that are handled not in a permanent container and assigned to cards when they begin cycle |
| containertypeid | `number` | unique identifier of the container's type |
| containertypename | `strng` | the container's type name (e.g. P01, T01) |
| istransitcontainer | `boolean` | transit containers are usually truck trailers and indicate that items placed inside them during trailer load are about to go in transit |
| children | `array` | the containers that are children of this container, if the API returns child containers |
| parentcontainerid | `number` | unique id of the parent of this container |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.container.trailer(trailer).unloadentiretrailer

Unloads an entire trailer by looping over its contents and unloading each one

```js
var resource = client.resources.container.trailer(trailer).unloadentiretrailer;
```

##### POST

Unloads an entire trailer by looping over its contents and unloading each one of them. Returns an array of the containers that were unloaded.

<br>

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **location** | *required* | `string` | The location where the trailer is being unloaded. |
| **actor** | *required* | `string` | Actor name doing the unload. |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.cardjob.forthing.thingname(thingname)

* **thingname** _string_

returns a card job associated with a thing name

```js
var resource = client.resources.cardjob.forthing.thingname(thingname);
```

##### GET

GetForThing returns the associated card job for this thing

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL; and are required.

| parameter | type | description |
|:----------|:-----|:------------|
| **thingname** | `string` | thing name |

#### RESPONSE FIELDS
standard card job fields - see 200 sample response below

```js
resource.get().then(function (res) { ... });
```

#### resources.cardjob.cardjobid(cardjobid).completekit

Completes one kit in a specific cardjob with serialized things taken from other cards

```js
var resource = client.resources.cardjob.cardjobid(cardjobid).completekit;
```

##### POST

Complete kit moves one or more things from on-hand cards onto another card that is in process building a kit.

Actions performed:
- CardJob completed quantity is increased by one (one kit has been completed)
- Card is assigned to the container.
- CardThings for the named items are moved to the destination card and assigned to the container/position.
- Thing quantities are consumed from their home cards.
- Things are not consumed because they are being transferred.

Prerequisites:
- The names in the workitems must be in thing table and cardthing table.
- The cardjob must be in process.

Validations which return an error:
- If thing part is not one of the kit parts
- If all kit parts/quantities are not matched exactly (too many or too few of a part)
- If provided container is attached to a card. Use reset marry to clear container.
- If positions are provided and part-based fixed positions are configured, if a given position is not in the list of allowed positions
- If more than one thing is put into the same position


#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **workitems** | *required* | `array` | each work item is {"name":"thingname", "quantity":N, "position": N}; position is optional |
| **containertag** | *required* | `string` | container into which things are being moved |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.cardjob.location(location).supplierperformancereport

Gets supplier performance for warehouse / zone location

```js
var resource = client.resources.cardjob.location(location).supplierperformancereport;
```

##### GET

SupplierPerformanceReport returns supplier performance report for a warehouse / zone level 

Actions performed:
- Get all the cardjobs for a warehouse / zone  from Readonly DB
- Calculate all the supplier performance (even for intransit and atdock performance)

Prerequisites:
- location should be valid and should only be a warehouse or zone location
- There must be cardjobs (that are not recalled)

Validations which return an error:
- If location is invalid
- If location is not a warehouse or zone location
- Hard DB error while getting cardjobs

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL; and are required.

| parameter | type | description |
|:----------|:-----|:------------|
| **location** | `string` | warehouse or zone name |

#### RESPONSE FIELDS
| field | type | description |
|:----------|:-----|:------------|
| locationid | `int64` | id of the location from request |
| locationname | `string` | location name from request |
| totalonhand | `int` | total onhand cardjobs |
| totalonhandpastdue | `int` | total onhand cardjobs that are past due|
| supplierperformance | `float` | supplier performance in percentage for aggregated onhand cardjobs at the requested location |
| totalatdock | `int` | total atdock cardjobs |
| totalatdockpastdue | `int` | total atdock cardjobs that are past due|
| atdocksupplierperformance | `float` | supplier performance for aggregated atdock cardjobs at the requested location |
| totalintransit | `int` | total intransit cardjobs |
| totalintransitpastdue | `int` | total intransit cardjobs that are past due |
| intransitsupplierperformance | `float` | supplier performance for aggregated intransit cardjobs at the requested location |
| partperformancereports | `array of PartPerformanceReports entty` | aggregated cardjob performance reports for each part |
| loopperformancereports | `array of LoopPerformanceReport entity` | aggregated cardjob performance reports for each loop |

```js
resource.get().then(function (res) { ... });
```

#### resources.cardjob.id(id).cycletime

Gets cycletime report for cardjob

```js
var resource = client.resources.cardjob.id(id).cycletime;
```

##### GET

GetCardJobCycleTimeReport returns cycle time report for a cardjob id  

Actions performed:
- Get all the pickitems for a cardjob from Readonly DB
- Calculate the cycle times for pickitems associated with a cardjob id

Prerequisites:
- cardjob id should be valid and should delivered pickitems 

Validations which return an error:
- If cardjob id is invalid
- Hard DB error while getting pickitems

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL; and are required.

| parameter | type | description |
|:----------|:-----|:------------|
| **id** | `int64` | cardjobid |

#### RESPONSE FIELDS
| field | type | description |
|:----------|:-----|:------------|
| cardjobid | `int64` | id of the cardjob from request |
| actualcycletime | `string` | actual cycle time (difference between onhand and begin cycle time) shows the overall cycle time |
| actualacceptime | `int` | actual accept time (difference between inprocess and begin cycle times) |
| actualleadtime | `int` | actual lead time (difference between intransit and inprocess times) |
| actualtransittime | `float` | actual transit time (difference between atdock time and intransit time) |
| actualhandlingtime | `int` | actual handling time (difference between onhand time and atdock time) |
| actualinspectionwaittime | `int` | actual inspection wait time|
| averagepickitemleadtime | `float` | average lead time for all the pickitems |
| pickitemleadtimes | `array of PickItemLeadTime entity` | calculated lead times for each pickitem |

```js
resource.get().then(function (res) { ... });
```

#### resources.cardjob.overdue

Returns cardjobs which are past due

```js
var resource = client.resources.cardjob.overdue;
```

##### GET

Return past due cardjobs report by location or part.

<br/>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **locationid** | *optional* | `number` | warehouse location id |
| **partid** | *optional* | `number` | part id |
| **loopsourcetype** | *optional* | `string` | loop source type either Make or Move or Order |

```js
resource.get().then(function (res) { ... });
```

#### resources.emes.frontface

Inform MOS that 10-digit BSN arrived on output position of a lane.

```js
var resource = client.resources.emes.frontface;
```

##### POST

The Fremont North Paint uses EMES software to manage the ASRS. This message is sent to MOS when a 10-character BSN arrives at the front face, also known as the exit position of a lane.
<br>

*Technical Detail*: The 10 digits are prefixed with TFR (Fremont Site) and the tens digit of the current year. Example: 8038000002 -> TFR18038000002. When called:
    if body has 1) open NC or 2) is on containment hold or 3) is scrap
        - Add NC Flag
         - Send to F1-Shuffle
              If you get an error because the entire first floor is full
                Send to "Shuffle" (same floor)



Also unset EMES NC if MOS NC conditions are false.

<br>

#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **timestamp** | *required* | `integer` | milliseconds since 1.1.1970 UTC |
| **serialid** | *required* | `string` | 10-character body serial number as tracked in EMES |
| **lane** | *required* | `integer` | the storage lane of the car body on that level |
| **level** | *required* | `integer` | the current storage level of the car body |
| **position** | *required* | `integer` | position |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.emes.statuschange

Inform MOS that 10-digit BSN has changed its status/location in ASRS.

```js
var resource = client.resources.emes.statuschange;
```

##### POST

This web service endpoint is provided by MOS. It is called by E-MES whenever a car is sent to GA. MOS should use this web service call to know when a requested car is sent and, thus, the floor is ready for the next request (no longer blocked). In the additional scope, the same web service endpoint is called whenever the status of a car changes. A status change occurs when the skid arrives at a reading station, and also when rule-engine or the internal model makes a routing decision (also during shuffling) (always returns current DESTINATION), or when the NC-flag is (manually) changed. MOS should use this web service call to maintain a list of cars in the buffer. The web service does NOT provide information about a (change of) position inside a lane. The web service does NOT provide information about status changes of several cars. I.e., when a lane is blocked for removal, all cars in the lane have their availability status changed. This is communicated via an "invalidate" message to MOS, so that MOS must request a full update of the ASRS contents. In detail, the web service is called at the following reading stations every time a skid arrives or is sent away:
•IS170 before lifter: decision to send to levels 1-4 and lane 1
•IS110 lane 1 position 10 (end of entry lane)
•IS200 lane 2 position 10 (end of shuffle lane)
•IS1100 floor 1 lane 10 position 10 (end of lane 10 after manual take-in)
•ISx90 position 1 lane 2-10 (front of buffer)
•IS1200 cross shuttle (internally: lane 0)
•IS410 lifter (internally: floor 0 lane 0)

The following flags are sent when a body leaves the system:
•SenttoGA=1: Set when a body skid is sent away from the lifter towards GA.
•SentToF1-EXIT=1: set when a body is sent from IS110 or IS200 towards the manual exit position at EH750.

<br>



#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **timestampcurrent** | *required* | `integer` | time of previous decision or action (e.g., time when car is sent to GA; time when a car is sent to a lane) (Long, milliseconds since 1.1.1970 UTC). |
| **timestampentered** | *required* | `integer` | the time a body entered the ASRS (Long, milliseconds since 1.1.1970 UTC) |
| **serialid** | *required* | `string` | 10-character body serial number as tracked in EMES |
| **lane** | *required* | `integer` | the storage lane of the car body on that level |
| **level** | *required* | `integer` | the current storage level of the car body |
| **nc** | *required* | `integer` | the value of the NC-flag (0/1) of the car body |
| **available** | *required* | `integer` | describes whether a car is available for (VIP-)requests; set to "0" when body is "sentToGA" |
| **sentToGA** | *required* | `integer` | set to 1 when a car is sent to assembly; set to 0 for all status updates inside the ASRS |
| **sentToF1-EXIT"** | *required* | `integer` | set to 1 when a car is sent to first floor exit; set to 0 for all status updates inside the ASRS |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.trial

Create a trial for Model3 GA and to get all trials.

```js
var resource = client.resources.trial;
```

##### GET

Get all trials.

```js
resource.get().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.get({ ... });
```

* **limit** _integer_

Specifies the maximum number of trials to load, use 0 to get all. Default value is 50.

* **statuses** _string_

Filters trials by status, only 'unreleased' is currently supported. 'unreleased' will remove all released trials from query results.

##### POST

A trial is defined by name, description, part, planneddate and notification email.

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.trial.name(name)

* **name** _string_

Get a trial by trial name, update an existing trial or delete a trial.

```js
var resource = client.resources.trial.name(name);
```

##### GET

Get a trial by trial name.

```js
resource.get().then(function (res) { ... });
```

##### PUT

Update a trial.

```js
resource.put().then(function (res) { ... });
```

##### Body

**application/json**

##### DELETE

Delete a trial.

```js
resource.delete().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.mfgorder

Allows to get or create MFG orders

```js
var resource = client.resources.mfgorder;
```

##### GET

Gets the full flat collection of MFG orders.

```js
resource.get().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.get({ ... });
```

* **limit** _integer_

Specifies the maximum number of trials to load, use 0 to get all. Default value is 50.

##### POST

Creates one MFG order.

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.mfgorder.term(term)

* **term** _string_

expression used for the search, must be an exact match of mfgorderno or serialnumber

Gets a specific MFG order

```js
var resource = client.resources.mfgorder.term(term);
```

##### GET

Gets one MFG order either by mfgorderno or serialnumber where an exact match exists for at least one of these properties.

```js
resource.get().then(function (res) { ... });
```

#### resources.mfgorder.advancedsearch

MFG order advanced searching

```js
var resource = client.resources.mfgorder.advancedsearch;
```

##### POST

Allows to query-for MFG orders with a wider variety of options.  Also note that the object returned has a lot of new properties most of which are related to sequencing operations.  This end-point will use the POST body and perform a query using 'AND' logic across all specified parameters.  The supported filtering parameters are the following:

##### Search Request Object
This is the main json object that is used in the post request, it is composed of three sub-objects.

| property | type                      | nullable | description                                           |
|:---------|:--------------------------|:---------|:----------------------------------------------------- |
| search   | searchCriteria (object)   | no       | Contains the conditions to be applied to the search.  |
| sort     | sortParameters (object)   | no       | Indicates the default ordering in which the results are returned. If empty it defaults to server-side default ordering. |
| page     | pagingParameters (object) | no       | Used to navigate across large sets.  If empty it defaults to page 1 with size of 100. |
| compact  | compact (object)          | yes       | Used to accept optional parameters, for example 'optiongroups'.
If empty or not provided, it will default to all MFG order option codes.


##### Search Criteria Object
This object contains properties that are used for searching, all properties are nullable; however most likely at least one of them needs to be used.
Any non-nullable property will be considered a filtering condition using an 'AND' operator.

| property | type | nullable | description |
|:---------|:-----|:---------|:------------|
| orderstatuses | []int | yes | Specifies which order statuses should be returned (1 - Planning, 2 - Firm, 3 - Frozen, 4 - GA, 5 - Rectification, 6 - Factory Gated). |
| plannedgaweek | dateRangeFilter (object) | yes | Filters by the planned GA week (revised or initial) with a to-from inclusive filter. |
| plannedgadate | dateRangeFilter (object) | yes | Filters by planned GA date (revised or initial) with a to-from inclusive filter. |
| processids | []int | yes | Can be used to filter orders sequenced on specific processes |
| batchconfigids | []int | yes | Can be used to filter orders belonging to a specific batch configuration (a.k.a. HW group) |
| batchids | []int | yes | Can be used to filter by specific batch instances |
| mfgorders | []string | yes | Can be used to retrieve only a specific set of MFG orders given their mfgorderno |
| partnumbers | []string | yes | Used to fiter by a set of partnumbers, usually will only be filtered by one part (e.g. Model 3 part number ) |

##### Sorting Parameters Object
This object is used to communicate to the server how we would like our results to be ordered.

| property | type | nullable | description |
|:---------|:-----|:---------|:------------|
| sortorder | string | no | Direction to be applied to the sort, accepts only two values: "asc" or "desc". If left empty it defaults to "asc" |
| sortby | string | no | Name of the property used for sorting, can only specify one.  If left empty the server will order by sequence number. |

Note: Only the following properties are sortable: `["mfgorderno", "processseqno", "batchorderseqno", "plannedgadate", "plannedgaweek", "serialnumber"]`

##### Paging Parameters Object
This object is used to fetch data in chunks, the server has a hard-limit of 50,000 items per page.  The client should request chunks as needed in sizes no larger than 50,000 at a time.

| property | type | nullable | description |
|:---------|:-----|:---------|:------------|
| pagenumber | int | no | The numbered chunk that we want - starting from 1. |
| pagesize | int | no | The maximum number of items to include in the chunk. |

Note: Smaller page sizes provide better performance, data aggregation is encouraged in the consumer side.

##### Date Range Filter Object

| property | type | nullable | description |
|:---------|:-----|:---------|:------------|
| from | date | yes | Accepts a null or RFC 3339 complaint date to filter starting from a specific point in time (inclusive). |
| to | date | yes | Acceptst a null of RF C3339 complaint date to filter ending at a specific point in time (inclusive). |

##### Compact Object
This object is used to allow optional parameter as part of search request. Currently we are only supporting 'optiongroups'. Specifying option groups values as part of search request allow us to pull only the needed data and reduce the load time of MFG orders page at this point. It can have None, All or specified option groups. If optiongroups value is None(optiongroups:["None"]), then None of MFG order option codes are returned as part of response. If optiongroups value is All(optiongroups:["All"]), then all of MFG order option codes are returned. Also supports specific one or more option groups e.g

optiongroups:["PAINT", "Battery"], this will return only paint and battery MFG order option codes in the response.

includebsn:false, with this flag turned on, the response will include BSN(Body Serial Number) also. Based on the amount of data(to and from date range etc) the API might take little longer. There is also configured limits on the amount of data applied if this flag is turned on.

| property | type | nullable | description |
|:---------|:-----|:---------|:------------|
| optiongroups | string array | yes | Option groups values like None, ALL or "PAINT", "Wheels" |
| includebsn | bool | yes | boolean value: true or false |

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.mfgorder.search

Search as you type

```js
var resource = client.resources.mfgorder.search;
```

##### GET

Provides a simple end-point that would usually be used to perform search-as-you-type lookups.  By default it searches by mfgorderno and returns the results; there's an optional parameter that allows to include the serialnumber in the search condition.

```js
resource.get().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.get({ ... });
```

* **includeserial** _boolean_

indicates if {term} should be searched in the serial number property or no

* **term** _string_

a combination of characters that is used to search MFG orders, by default it only searches by mfgorderno

* **limit** _integer_

Specifies the maximum number of MFG orders to load, use 0 to get all. Default value is 50.

#### resources.mfgorder.hwgroups

Calculates HW groups for the given orders

```js
var resource = client.resources.mfgorder.hwgroups;
```

##### POST

Given a set of MFG orders this will dynamically calculate its corresponding HW group and return them.

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.mfgorder.optiongroups

Gets all the global active option groups

```js
var resource = client.resources.mfgorder.optiongroups;
```

##### GET

Gets all the active option groups in MOS.

```js
resource.get().then(function (res) { ... });
```

#### resources.mfgorder.partnumber(partnumber).mfgorderno(mfgorderno).hwgroup

Updates the HW group

```js
var resource = client.resources.mfgorder.partnumber(partnumber).mfgorderno(mfgorderno).hwgroup;
```

##### PUT

Assigns a specific HW group to the given MFG order given that both exists.  Does not perform option code matching logic.

```js
resource.put().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.mfgorder.statuscounts.partnumber(partnumber)

* **partnumber** _string_

Gets the MFG order count aggregated by status

```js
var resource = client.resources.mfgorder.statuscounts.partnumber(partnumber);
```

##### GET

Gets the aggregated count by MFG order status of all MFG orders for a specific part number.

```js
resource.get().then(function (res) { ... });
```

#### resources.mfgorder.mfgorderno(mfgorderno).mfgorderoptioncode

Provides the capability to add or remove specific option codes to a MFG order

```js
var resource = client.resources.mfgorder.mfgorderno(mfgorderno).mfgorderoptioncode;
```

##### POST

Creates a new MFG order option code for the given MFG order.  If the given combination of option group + option code already exists the request is ignored and returns successfully. An error will be returned in case the MFG order already has an assigned option code for the given option group, e.g. If the MFG order already has PAINT-BLUE sending a reques to add PAINT-RED is not allowed.

A special validation case happens when the system detects that a 'thing' already exists for the given MFG order.  In such a scenario the request will error out.

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

##### DELETE

Deletes an existent MFG order option code for the given MFG order.  If the given combination of option group + option does not exist the request is ignored and returns successfully.

A special validation case happens when the system detects that a 'thing' already exists for the given MFG order.  In such a scenario the request will error out.

```js
resource.delete().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.mfgorder.mfgorderoptioncode

Provides the capability to update multiple optioncodes for multiple MFGOrders

```js
var resource = client.resources.mfgorder.mfgorderoptioncode;
```

##### PUT

Updates one or more option codes for one or more MFG Orders. Request payload have the following optional inputs:
- orderstatus
- swapreason

Currently 'orderstatus' is being used to determine the MFG order stale state and validates the request on the option code swap tool(UI). If a value is provided here like (2,3,4...), the API will validate the MFG order status against the provided status value and if it does not match the current MFG order state (in the backend DB), the request will be rejected providing reason for rejection.

Swap reason(swapreason in the payload) if populated will be logged for tracing purpose.

```js
resource.put().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.downloadurl(id)

* **id** _string_

Gets the specified artifact's pre-signed URL

```js
var resource = client.resources.downloadurl(id);
```

##### GET

Returns the specified artifact's pre-signed URL along with metadata. The URL
is only valid for 1 hour and allows anyone with it to download the artifact
without credentials.

<br>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **ID** | *required* | `number` | the artifact's numeric ID |


Fields in the response include:

| field | type | description |
|:----------|:-----|:------------|
| id | `number` | unique identifier of the artifact |
| name | `string` | name of the artifact |
| storage | `string` | type of storage the artifact is stored in |
| contenttype | `string` | type of the artifact |
| description | `string` | description tied with the artifact |
| bucket | `string` | S3 bucket the artifact is stored in |
| targetpath | `string` | path the artifact is in the bucket |
| isactive | `number` | if the artifact is currently active in S3 |
| modified | `string` | modified date |
| modifiedby | `number` | who last modified the artifact |
| created | `string` | created date |
| createdby | `number` | who created the artifact |
| rowversion | `number` | artifact row |
| signedurl | `string` | pre-signed url of the artifact |

```js
resource.get().then(function (res) { ... });
```

#### resources.mfgordersequence.count

Count of sequenced orders

```js
var resource = client.resources.mfgordersequence.count;
```

##### GET

Get MFG sequenced orders count starting from a provided process sequence number for a specific process until last sequence.

```js
resource.get().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.get({ ... });
```

* **processid** _integer_

Specifies the process ID.

* **processseqno** _integer_

Specifies the starting process sequence number.

#### resources.mfgordersequence.revertfrozentoplanning

MFG order Revert Frozen to Planning

```js
var resource = client.resources.mfgordersequence.revertfrozentoplanning;
```

##### GET

Previews effect of Revert MFG Order API without any persistent change. No database changes are made, and WARP is not notified. Same input/output contract as Revert.

```js
resource.get().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.get({ ... });
```

* **processname** _string_

Specifies the process by name.

* **partnumber** _string_

Specifies the part by part number.

* **minseqno** _integer_

Minimum Sequence Number, the starting sequence number that you would like to revert.

* **maxseqno** _integer_

Maximum Sequence Number, the final sequence number that you would like to revert.

* **expectedcount** _integer_

Expected Count, the expected number of orders to be reverted.

##### PUT

Reverts 1 or more MFG Ordersfrom the Firm status to Planning status for a process and part. The highest sequenced order for a process may not be reverted. 


#### BODY PARAMETERS
Input parameters are passed in the raw post body as JSON fields.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **partnumber** | *required* | `string` | the partnumber of the mfg order being reverted |
| **processname** | *required* | `string` | the processname where the part is made i.e. 1MN1, 1MN2, GA4 |
| **minsequencenumber** | *required* | `number` | lowest sequence number |
| **maxsequencenumber** | *required* | `number` | highest sequence number |
| **expectedcount** | *required* | `number` | the number of orders expected to be reverted |

```js
resource.put().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.mfgordersequence.buildplan

Add, change or overwrite MFG orders in the build plan

```js
var resource = client.resources.mfgordersequence.buildplan;
```

##### POST

Add new orders to the sequence file or change the sequencing of orders. Same endpoint can also be used to overwrite current plan. Overwrite will first delete the specific process sequeces and then allow sequencing again. Here is an example payload for overwrite plan:

{
  "overwriteplan": {
    "processid": 16602,
    "processseqno": 37740
  },
  "manufacturingorders": [
    {
      "mfgorderno": "9700813676",
      "plannedgadate": "2018-09-20T07:00:00.000Z",
      "batchorderseqno": 1,
      "processname": "1MN2",
      "hwgroup": "P003_1_NAL",
      "batchno": 52
    }
  ]
}

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

##### DELETE

Deletes a specific week from the build plan

```js
resource.delete().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.delete(null, { query: { ... } });
```

* **payload** _string_

Stringified JSON of the following object:

    {
        "type": "single-part-multi-process",
        "partnumber": "1018484-00-A",
        "processname": "HP020",
        "timezone": "America/Los_Angeles",
        "from": "2018-06-22T07:00:00Z"
    }

When this is represented in the query string it will look like this:

     ?payload={%22type%22:%22single-part-multi-process%22,%22partnumber%22:%221065600-00-B%22,%22processname%22:%22%22,%22from%22:%222018-09-10T07:00:00.000Z%22,%22timezonename%22:%22America/Los_Angeles%22}

##### Body

**application/json**

#### resources.mfgordersequence.recalibrate

Recalibrate backlog orders

```js
var resource = client.resources.mfgordersequence.recalibrate;
```

##### PUT

Recalibrate can be used for both part based(M3) orders as well as process based(internal) orders recalibration.

Payload for process based(internal) orders recalibration:

{
  "type": "multi-part-one-process",
  "partnumber": "",
  "processname": "BP5",
  "timezonename": "America/Los_Angeles"
}

```js
resource.put().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.ar.suspectcount

Get all action request with suspect count

```js
var resource = client.resources.ar.suspectcount;
```

##### GET

Get all action request with suspect count based on hold type

```js
resource.get().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.get({ ... });
```

* **holdtype** _integer_

represents hold type like 1 (Quality) or 2 (Process) hold

* **limit** _integer_

number of results to return - defaults to 50

#### resources.suspect.thingname(thingname).hold

Get thing hold info

```js
var resource = client.resources.suspect.thingname(thingname).hold;
```

##### GET

Get hold information for thing and its children

```js
resource.get().then(function (res) { ... });
```

#### resources.suspect.suspectprocess.merge

Merge suspect processes

```js
var resource = client.resources.suspect.suspectprocess.merge;
```

##### PUT

MergeSuspectProcesses performs a smart merge between the existing suspect processes and the new suspect processes that are provided, it will basically do the following: create new suspect processes if they don't exist in DB, delete obsolete suspect processes, skip matching suspect processes.

```js
resource.put().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.suspect.suspectprocess.delete

Delete suspect processes

```js
var resource = client.resources.suspect.suspectprocess.delete;
```

##### PUT

Delete suspect processes

```js
resource.put().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.demandplanning

Demand Planning is the endpoint used to create, read, and delete internal MFG Orders.

```js
var resource = client.resources.demandplanning;
```

##### GET

Get planning MFG Orders over a specified time range.

```js
resource.get().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.get({ ... });
```

* **fromweek** _date_

The date that is the starting week for orders to be loaded.

* **numberofweeks** _integer_

The number of weeks of MFG Orders to load. Min: 1, Max: 60.

* **timezonename** _date_

The timezone used for the date specified in week.

##### POST

Create a batch of MFG Orders in order status planning.

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

##### DELETE

Delete planning MFG Orders for a particular part over a specified time range.

```js
resource.delete().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.delete(null, { query: { ... } });
```

* **week** _date_

The date that is the starting week for orders to be deleted.

* **timezonename** _string_

The timezone used for the date specified in week.

* **part** _string_

The part which will be deleted. Type should be part.

#### resources.asn.stack.status.notreceived

ASN represents the shipment notices / orders from customers.

```js
var resource = client.resources.asn.stack.status.notreceived;
```

##### GET

Return the list of stacks (and trays) that are not received yet.

<br>

#### QUERY PARAMETERS
Query parameters are passed as a query string in the URL. **NOTE:** only one may be used.

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| limit  | optional |  `number` | limits the list to the number passed, default is 50 |

```js
resource.get().then(function (res) { ... });
```

#### resources.unnetteddemand.shipnext

attempts to ship the next body from the EMES ASRS to the tunnel/XC1 for the specified process(es)

```js
var resource = client.resources.unnetteddemand.shipnext;
```

##### POST

attempts to ship the next body from the EMES ASRS to the tunnel/XC1 for the specified process(es)

Payload for shipnext (below are the default values if one or neither are provided):

{
  "partnumber": "1065600-00-B",
  "processes": "1MN1,1MN2"
}

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.prodplansnapshot

Capture and retrieve Model 3 production plan snapshots.

```js
var resource = client.resources.prodplansnapshot;
```

##### GET

Get snapshot data by page number and page size

```js
resource.get().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.get({ ... });
```

* **pagenumber** _integer_

Specifies the staring ID of the production plan snapshot

* **pagesize** _string_

Specifies the number of rows in the production plan snapshot to bring back

#### resources.prodplansnapshot.capture

Capture Model 3 production plan snapshot

```js
var resource = client.resources.prodplansnapshot.capture;
```

##### POST

A Model 3 production plan snapshot represents daily and updated states of a plan.

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.prodplansnapshot.links

Get production plan persisted snapshot links (snapshot header info)

```js
var resource = client.resources.prodplansnapshot.links;
```

##### GET

Get production plan snapshot links

```js
resource.get().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.get({ ... });
```

* **limit** _integer_

Specifies the maximum number of snapshots to load

* **sourcetype** _string_

Specifies the plan MFG order source type, for Model 3 orders, it is not needed

#### resources.thingkpmdata.thingname(thingname).stages

represents thing KPM stages for a thing

```js
var resource = client.resources.thingkpmdata.thingname(thingname).stages;
```

##### GET

Get thing KPM data stages for a provided thing name.

```js
resource.get().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.get({ ... });
```

* **thingname** _string_

Specifies the thing name for which we want to get the stages data.

#### resources.spc.thingsbyflowstep

List of thingnames recent left a flowstep

```js
var resource = client.resources.spc.thingsbyflowstep;
```

##### GET

Get (with authorizaton Operator) the list of thingnames that have left a flowstep in a perdid of time (max 24 hours) from the read-only DB


<br>

#### BODY PARAMETERS
n/a

```js
resource.get().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.get({ ... });
```

* **processname** _string_

MOS processname

* **flowstepname** _string_

MOS flowstepname on same process

* **hours** _integer_

number of hours included in the response up 24

#### resources.batchtrack

Batch track helps in capturing and tracking batch changes for a production line.

```js
var resource = client.resources.batchtrack;
```

##### GET

Get all batch tracks

```js
resource.get().then(function (res) { ... });
```

#### resources.batchtrack.id(id)

* **id** _string_

Get a batch track by ID.

```js
var resource = client.resources.batchtrack.id(id);
```

##### GET

Get a batch track by ID.

```js
resource.get().then(function (res) { ... });
```

#### resources.batchtrack.process

Get a batch track for a specific process ID or process name.

```js
var resource = client.resources.batchtrack.process;
```

##### GET

Get a batch track for a specific process ID or process name. Either process ID or process name must be passed.

```js
resource.get().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.get({ ... });
```

* **id** _integer_

Specifies the ID of a process

* **name** _string_

Specifies the name of a process

#### resources.batchtrack.part

Get batch tracks for a specific part.

```js
var resource = client.resources.batchtrack.part;
```

##### GET

Get batch tracks for a specific part by providing previous or current part number. Either previous or current part number must be passed.

```js
resource.get().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.get({ ... });
```

* **previouspart** _string_

Specifies the previous part number of a batch track

* **currentpart** _string_

Specifies the current part number of a batch track

#### resources.dispatch.swapsequence

Allows swap sequence functionality for MFG orders

```js
var resource = client.resources.dispatch.swapsequence;
```

##### PUT

Swaps provided current and desired MFG orders sequence. Currently supports only MFG order with status 'Firm' or 'Frozen'. Supported combinitions are Firm->Firm, Firm->Frozen(Frozen->Firm) and Frozen->Frozen.

```js
resource.put().then(function (res) { ... });
```

##### Body

**application/json**

#### resources.kafkautil.publish.topic(topic)

* **topic** _string_

Sends messages to kafka for the given topic

```js
var resource = client.resources.kafkautil.publish.topic(topic);
```

##### POST

Sends messages to kafka for the given topic

```js
resource.post().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.post(null, { query: { ... } });
```

* **payload** _string_

Stringified JSON of object according to topic requirements.
Below is an example:

    {
        "type": "single-part-multi-process",
        "partnumber": "1018484-00-A",
        "processname": "HP020",
        "timezone": "America/Los_Angeles",
        "from": "2018-06-22T07:00:00Z"
    }

When this is represented in the query string it will look like this:

     ?payload={%22type%22:%22single-part-multi-process%22,%22partnumber%22:%221065600-00-B%22,%22processname%22:%22%22,%22from%22:%222018-09-10T07:00:00.000Z%22,%22timezonename%22:%22America/Los_Angeles%22}

##### Body

**application/json**

#### resources.demandpartprocessdetail

Create demand part process detail.

```js
var resource = client.resources.demandpartprocessdetail;
```

##### POST

Create new demandpartprocessdetails for a given demandpartprocess

#### URL PARAMETERS
URL parameters are passed in url in key=value&key2=value2 format

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| includeordersinga | *optional* | `boolean` | include orders in ga for adjust |
| startsequenceno | *optional* | `number` | mfgorder start process sequence number. |
| endsequenceno | *optional* | `number` | mfgorder end process sequence number. |

#### BODY PARAMETERS
Body parameters are passed as the POSTed body in the request, which is an object containing array of demandpartprocessdetail.

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**

##### DELETE

Deletes a specific demandpartprocessdetail

```js
resource.delete().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.delete(null, { query: { ... } });
```

* **payload** _string_

Deletes a specific demandpartprocessdetail

#### URL PARAMETERS
URL parameters are passed in url in key=value&key2=value2 format

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **id** | **required** | `int` | primary key of the demandpartprocessdetail. |
| includeordersinga | *optional* | `boolean` | include orders in ga for adjust |
| startsequenceno | *optional* | `number` | mfgorder start process sequence number. |
| endsequenceno | *optional* | `number` | mfgorder end process sequence number. |

##### Body

**application/json**

#### resources.demandpartprocessdetail.computedemandchanges

computes changes to sequence demand for create or delete of demandpartprocessdetail

```js
var resource = client.resources.demandpartprocessdetail.computedemandchanges;
```

##### POST

Compute sequence demand changes for creation/deletion of demandpartprocessdetail 


#### URL PARAMETERS
URL parameters are passed in url in key=value&key2=value2 format

| parameter | required | type | description |
|:----------|:---------|:-----|:------------|
| **editflag** | *required* | `string` | must be either CREATE or DELETE. |
| id | *optional* | `int` | primary key of the demandpartprocessdetail **required** when editflag is DELETE. |
| includeordersinga | *optional* | `boolean` | include orders in ga for adjust. |
| startsequenceno | *optional* | `number` | mfgorder start process sequence number. |
| endsequenceno | *optional* | `number` | mfgorder end process sequence number. |


Body is **required** for computing sequence demand changes for creation of new  demandpartprocessdetail
#### BODY PARAMETERS 
Body parameters are passed as the POSTed body in the request, which is an object containing array of demandpartprocessdetail.

```js
resource.post().then(function (res) { ... });
```

##### Body

**application/json**



### Custom Resources

You can make requests to a custom path in the API using the `#resource(path)` method.

```javascript
client.resource('/example/path').get();
```

## License

Apache 2.0

---
_Source: https://npm.io/package/mos-execution-apis · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
