Smart Shop Floor APIs
Provide the clients with the ability to programmatically creates jobs in the smart shop floor and export the jobs data from the portal when completed.
This feature provides the client with the ability to:
- Get all machines with the category it falls under
- Allow posting of Jobs on the smartshop floor via HTTP POST API
- Export job when completed in the form of either HTTP POST or HTTP Get API
- Programatically fetch the machines work completed with a HTTP GET API (exports data for a particular machine between two dates)
- Fetch Utilisation Status for a single machine between multiple dates
What’s a REST API ?
API is an acronym for Application Programming Interface - in short, it’s a set of rules that lets programs talk to each other, exposing data and functionality across the internet in a consistent format.
REST stands for Representational State Transfer. This is an architectural pattern that describes how distributed systems can expose a consistent interface. When people use the term ‘REST API,’ they are generally referring to an API accessed via HTTP protocol at a predefined set of URLs.
These URLs represent various resources to access any information or content accessed at that location, which can be returned as JSON or images. Often, resources have one or more methods that can be performed on them over HTTP, like GET, POST, PUT and DELETE.
Authenticate with HTTP
To authenticate your HTTP API, you need to go to the Configuration >> Settings section copy the api key and url from there.
This key needs to be passed in the header of your HTTP request. ApiKey: [API key from the Configuration >> Settings section]
Version
The SSF API are version controlled api, the current latest version of the API is 1.0.
Postman
Click here to download the postman collection for accessing the API's via postman. Import the collection and setup the environment variables as per your portal configurations.
Get Workcentres
Fetches all workcentres defined within SmartShopFloor portal
URL: https://[subdomain].smartshopfloor.cloud/api/1.0/getWorkCentres
| Field | Description |
|---|---|
| workCentreId | Id of the work centre. |
| workCentre | Name of the work centre. |
| shortName | Short name of the work centre. |
| tag | Value provided in the tag field of the workcentre page. Use this to link the 3rd party system workcentre id. |
Sample Response
HTTP GET
{
"workCentres": [
{
"workCentreId": "621ee615272bd7000eb546e0",
"workCentre": "Camshafts",
"shortName": "Cams",
"tag": "69SQI"
},
{
"workCentreId": "621ee62f272bd7000eb546e1",
"workCentre": "Conrods",
"shortName": "Conrod",
"tag": "65AIB"
}
]
}
Get Machines
Fetches all machines defined within SmartShopFloor portal.
URL: https://[subdomain].smartshopfloor.cloud/api/1.0/getMachines
| Field | Description |
|---|---|
| machineId | Unique ID of each machine |
| machineName | Machine name |
| workCentreId | Id of the work centre where the machine is located. |
| workCentre | Name of the work centre where the machine is located. |
| categoryId | Unique category ID of each machine |
| categoryName | Category name under which the machine falls into |
| tag | Value provided in the tag field of the machine page. Use this to link the 3rd party system machine id. |
Sample Response
HTTP GET
{
"machines": [
{
"machineId": "61dbbfa9f0f818011537538c",
"machineName": "AMC (005)",
"workCentreId": "621ee88d272bd7000eb546e9",
"workCentre": "Rebore",
"categoryId": "61dbb6e6f0f8180115375381",
"categoryName": "Blocks",
"tag": ""
},
{
"machineId": "61dbbfa9f0f8180115375391",
"machineName": "EUMACH (345)",
"workCentreId": "621ee677272bd7000eb546e4",
"workCentre": "Engineering",
"categoryId": "621ee487272bd7000eb546d3",
"categoryName": "Cranks",
"tag": "345"
}
]
}
Post Job
Create a new job using this api in the SSF portal. If the job already exists then it will be updated.
URL: https://[subdomain].smartshopfloor.cloud/api/1.0/postJob
| Field | Description |
|---|---|
| Request | |
| code | Unique job code |
| meta | The metadata pertaining to a job will be entered here. This fields are dynamic and can vary from client to client basis. They can be fetched from the getMeta API. |
| components | Defines the array of components and operations to be performed in the job. |
| name | The name of the component. |
| operation | the name of the operation |
| workCentreId | The id of the work centre where the operation needs to be performed. The workCentreId can be fetched from the getWorkCentres API. |
| categoryId | The category of the machine where the operation is to be performed |
| machineId | The id of the machine where the operation is to be performed. Use the getMachines API to find relevant machineId. |
| workInstruction | Instructions associated to the particular operation. |
| dueDate | Date by which the operation needs to be completed. |
| status | Current status of the component |
| quantity | Number of components or parts to be worked on. |
| priority | Priority of the job/component |
| sequenceNo | Sequence at which the operation would execute. |
| prevComp | The previous operation for maintaining a sequence. |
| group | Provide a group name when the operations are to be performed on the same machine as a group |
| duration | Estimated duration in minutes is the time it take an operation to complete. |
| Responses | |
| message | Displays a message in certain instances. E.g. "job imported successfully" |
| jobId | Returns the job Id which got created |
!!! note The deprecated fields if used and the same fields inside the components are not in use, then the data from the deprecated fields will be copied automatically in the new relative fields
Sample Request
POST Request
{
"code": "S48613",
"meta": {
"serialNo":"ICM23567",
"model": "CAT323516",
"customerName": "ABCL",
"orderNo": "4500484",
"contactName": "ABCL PTY LTD",
"email": null
},
"components": [
{
"name": "R/ARM",
"categoryId": null,
"operation": "WAUVHPRAR",
"machineId": null,
"workCentreId": "621ee62f272bd7000eb546e1",
"workInstruction": "MACH CRANK C/WEIGHT MNT",
"dueDate": "2022-04-22T00:00:00",
"status": "active",
"priority": "2",
"quantity": "16",
"sequenceNo": "1",
"group": null,
"prevComp": null,
"duration": null
},
{
"name": "CRANK",
"categoryId": null,
"operation": "CAT3516CG",
"machineId": null,
"workCentreId": "621ee615272bd7000eb546e0",
"workInstruction": "GRIND MAINS & BIG ENDS .025 / .025 AND POLISH SEAL AREAS.",
"dueDate": "2022-05-21T00:00:00",
"status": "active",
"priority": "2",
"quantity": "1",
"sequenceNo": "2",
"group": null,
"prevComp": null,
"duration": 50
},
{
"name": "CRANK",
"categoryId": null,
"operation": "CRRW",
"machineId": null,
"workCentreId": "621767e3ba921400060a6d5c",
"workInstruction": "REMOVE&REPLACE C/WEIGHT NEW #16 UPGRADED CREW-CUT COUNTERWEIGHT TO BE FITTED. NEW COUNTERWEIGHT BOLTS TO BE FITTED AFTER BALANCING. NEW COUNTERWEIGHT DOWELS TO BE FITTED BEFORE BALANCING.",
"dueDate": "2022-05-21T00:00:00",
"status": "active",
"priority": "2",
"quantity": "1",
"sequenceNo": "3",
"group": null,
"prevComp": "CRANK||CAT3516CG",
"duration": 90
}
]
}
Response
{
"message": "Job imported successfully.",
"job": "62d6807f3776485754af87ee"
}
Error Response
{
"statusCode": 400,
"error": "Bad Request",
"message": "\"dueDate\" must be a valid ISO 8601 date"
}
Close Job
The API allows you to close the job or individual component. When the component and operation are not specified as parameters the whole job code will be closed. If the component and operation both are specified only that operation within the component will be closed. The status will be closed, if an operator has worked on that job/operation. The job status will be cancelled, if an operator has not worked on the job/operation.
URL: https://[subdomain].smartshopfloor.cloud/api/1.0/closeJob
| Field | Description |
|---|---|
| Request | |
| code | Unique job code |
| component | Name of the component to be closed (optional) |
| operation | Name of the operation to be closed (optional) |
| isForceClose | Closes the job/component even though they are in progress (boolean value true/false). |
| Responses | |
| status | This is a response code for the http request |
| message | Displays a message in certain instances. E.g. "job imported successfully" |
| jobid | Returns the job Id which got created |
Sample Request
POST Request
//Close a job. set component and operation to null. Set isForceClose to true if you wish to close the job even if some operations are in progress on the job. If no work is done on the machine then the component status is set to cancelled. If work is done on machine then the component status is set to closed.
{
"code": "149555",
"component": null,
"operation": null,
"isForceClose": true
}
OR
//Close an operation. Set component and operation to their respective name. Set isForceClose to true always.
{
"code": "149555",
"component": "MANIFOLD",
"operation": "SCALE",
"isForceClose": true
}
{
"message": "Job closed successfully.",
"job": "62b91393a402cb00086332f0"
}
OR
{
"message": "Component closed successfully.",
"component": "62b53408e8915a000755c605"
}
OR
Error Response
{
"statusCode": 400,
"error": "Bad Request",
"message": "Component with this name and operation within the given job code des not exist."
}
Export Jobs
Export data for all jobs between two dates. The data will be displayed only when an operator has worked on the job. When a job code is passed data for the specified job will be provided.
URL: https://[subdomain].smartshopfloor.cloud/api/1.0/getJobs?startDate=2019-10-15&endDate=2021-10-15 https://[subdomain].smartshopfloor.cloud/api/1.0/getJobs?jobCode=148447
| Field | Description |
|---|---|
| Request Query Parameters | |
| startDate | Defines the beginning of a date range for exporting job data |
| endDate | Defines the end of a date range for exporting job data |
| jobCode | Fetch data for the respective jobcode, the dates will be ignored when jobcode is set. |
| Response | |
| message | Displays a message in certain instances. E.g. "no data found" when there are no records available for the specified date range |
| startdate | The beginning of a date range as specified in the request |
| enddate | The end of a date range as specified in the request |
| jobCode | Fetch data for the respective jobcode, the dates will be ignored when jobcode is set. |
| jobId | Unique job id provided by the system |
| datatype | Data type of the query. E.g. job |
| code | Unique job code |
| startedBy | Name of the person who created the job |
| startedDate | Date on which the job was created |
| dueDate | Job due date |
| utilisation | Cumilaive utilisation (in minutes) for all machines in this job |
| jobStatus | Current status of the job |
| meta | The meta fields contains dynamic fields that are defined at the time of client creation. These fields can hold free text or numeric data like serionl no, PO, sales order, customer name, description, material cost, estimate cost, etc. |
| components | The components array contains all the data about the components and different operations performed on them. |
| name | Name of the component. |
| componentId | Component unique identifier |
| operation | Name of the operation performed on the component |
| utilisation | Cumulative utilisation (in minutes) of all the machines utilised for all the components |
| quantity | The quanity of the components on which the work is to be performed or the number of units requried to be manufactured |
| dueDate | the date by which the operation is required to be completed |
| duration | the duration array provides the data about the work performed on the operations the timings the workcentre and machine involved to accomplish the operation |
| machineId | Unique id of the machine on which the operation was performed |
| machine | the name of the machine on which the work is performed |
| workCentreId | Unique id of the workCentre on which the operation was performed |
| workCentre | the name of the workCentre on which the work is performed |
| workStarted | The date and time at which the operation was started in UTC format |
| workEnded | The date and time at which the operation was completed in UTC format |
Sample Request
Response
{
"message": null,
"query": {
"jobCode": "148447",
"startDate": null,
"endDate": null
},
"jobs": [
{
"jobId": "6256595aa14a11000818a077",
"datatype": "job",
"code": "148447",
"startedBy": "Pieter Diedericks",
"startedDate": "2022-04-22T03:48:52.154Z",
"dueDate": "2022-10-04",
"utilisation": 0,
"jobStatus": "started",
"jobInstruction": "",
"meta": {
"jobInstruction": "",
"serialNo": "793C MSN:4AR00277,ESN:SPW10034,ARN:**-****",
"customerName": "ABCL",
"model": "CAT3516",
"orderNo": "4500110130",
"contactName": "ABCL PTY LTD",
"email": ""
},
"components": [
{
"name": "BLOCK",
"operation": "CAT3516BLB",
"utilisation": 0,
"quantity": 1,
"dueDate": "2022-06-27",
"duration": [
{
"fromTime": "2022-06-22T00:22:25.000Z",
"toTime": "2022-06-23T00:38:28.000Z",
"machineId": "61dbbfa9f0f818011537539e",
"machine": "F99 #2 (338)",
"workCentreId": "621ee88d272bd7000eb546e9",
"workCentre": "Rebore"
}
]
}
{
"name": "BLOCK",
"operation": "CAT3516BSGMS",
"utilisation": 0,
"quantity": 1,
"dueDate": "2022-06-27",
"duration": [
{
"fromTime": "2022-06-15T03:12:07.000Z",
"toTime": "2022-06-19T22:08:12.000Z",
"machineId": "61dbbfa9f0f818011537539b",
"machine": "F88 #1 (225)",
"workCentreId": "621ee88d272bd7000eb546e9",
"workCentre": "Rebore"
},
{
"fromTime": "2022-06-19T22:08:12.000Z",
"toTime": "2022-06-20T00:36:09.000Z",
"machineId": "61dbbfa9f0f818011537539b",
"machine": "F88 #1 (225)",
"workCentreId": "621ee88d272bd7000eb546e9",
"workCentre": "Rebore"
}
]
}
]
}
]
}
Export Machine Work
Export data for the operations performed for a particular machine between two dates
URL: https://[subdomain].smartshopfloor.cloud/api/OpenApi/getMachineWork?startDate=2019-10-15&endDate=2021-10-15&machineId=61dbbfa9f0f818011537539b
| Field | Description |
|---|---|
| Request Query Parameters | |
| machineId | Unique ID of each machine |
| startDate | Defines the beginning of a date range for exporting machine data |
| endDate | Defines the end of a date range for exporting machine data |
| Response | |
| message | Displays a message in certain instances. E.g. "no data found" when there are no records available for the specified date range |
| query |
|
| Jobs | details about the operations of the jobs performed on that machine between that date range. |
| code | Unique job id provided by the system |
| fromTime | Date on which the job was started |
| toTime | Date on which the job ended |
| duration | The duration for which the work was performed in seconds. |
| component | Name of the component on which operation is performed. |
| operation | Name of the operation. |
Sample Request
Response
{
"message": "",
"query": {
"machineId": "61dbbfa9f0f818011537539b",
"startDate": "2022-06-29",
"endDate": "2022-06-30"
},
"jobs": [
{
"fromTime": "2022-06-29T02:48:02Z",
"toTime": "2022-07-01T00:19:37Z",
"duration": 163895,
"code": "149549",
"component": "BLOCK",
"operation": "CUMQSK60BSGV"
},
{
"fromTime": "2022-06-28T22:00:00Z",
"toTime": "2022-06-29T02:47:02Z",
"duration": 17222,
"code": "148555",
"component": "BLOCK",
"operation": "CAT3516BSGMS"
}
],
"machine": {
"_id": "61dbbfa9f0f818011537539b",
"name": "F88 #1 (225)",
"workcentre": "Rebore",
"category": "Blocks"
}
}
Get Utilisation
The API provides data data for the machine statuses linked to each job code along with the duraion of the status.
URL: https://[subdomain].smartshopfloor.cloud/api/1.0/getUtilisation?startDate=2021-04-10&endDate=2021-06-10&machineId=null
| Field | Description |
|---|---|
| Request Query Parameters | |
| machineId | Unique ID of each machine |
| startDate | Defines the beginning of a date range for exporting utilisation data |
| endDate | Defines the end of a date range for exporting utilisation data |
| shiftNumber | The shift number in which the machine was used |
| Response | |
| message | Displays a message in certain instances. E.g. "no data found" when there are no records available for the specified date range |
| query |
|
| date | Date and time when the machine was used |
| statusId | Unique status id |
| statusName | Current machine status. E.g. utilised/idle |
| duration | The time duration of machine's uptime/downtime |
| type | Status type: uptime/downtime |
| code | Unique job id |
Sample Request
Response
{
"message": "",
"query": {
"machineId": "61dbbfa9f0f818011537539b",
"startDate": "2022-06-01",
"endDate": "2022-06-02",
"shiftNumber": null
},
"statuses": [
{
"date": "2022-06-02T10:06:24.000Z",
"statusId": "6172b0761fa09e0006e2bee2",
"statusName": "Idle",
"duration": 51075,
"type": "downtime",
"code": ""
},
{
"date": "2022-06-02T10:03:18.000Z",
"statusId": "6180cd68da719100069be82e",
"statusName": "Utilised",
"duration": 186,
"type": "uptime",
"code": ""
},
{
"date": "2022-06-02T10:03:06.000Z",
"statusId": "6172b0761fa09e0006e2bee2",
"statusName": "Idle",
"duration": 12,
"type": "downtime",
"code": ""
}
]
}
Get Job Metadata
Use this API to fetch what job related meta data can be posted with the job. use the 'key' element from the response json to populate the data in postJob API.
URL: https://[subdomain].smartshopfloor.cloud/api/1.0/getMeta
| Field | Description |
|---|---|
| Response | |
| type | The type determine the datatype of the field, currently only text and number are supported. |
| label | label provides the field label that will be displayed on the job creation page. |
| key | use the key value to populate the post job API. |
| search | Provides an understanding of whether the field can be searched or not. |
Sample Request
Response
[
{
"type":"text",
"label":"Customer Name",
"key":"customerName",
"search":"true"
},
{
"type":"text",
"label":"Serial No",
"key":"serialNo",
"search":"true"
}
]