CWork API Documentation (v1.9)

API Endpoint

CWork has a REST api that you can request to obtain data about your DNC or MDC installation.

Licensing

To fully or partially access CWork’s API, you need to have an according license. If you don’t or if you just don’t know, contact your reseller.
This documentation will tell you which license you should acquire to access each resource. Search for the license required property.

Here are the existing API license types :

  • monitor

  • dnc
    More to come…

In the following documentation, any means that any API license module will give you access to the specified function.

Authentication

As from v1.2 CWork’s API requires HTTP Basic Authentication (see RFC-2617 for more information on HTTP Authentication standards).

  • The user field of the Authorization header will need to be the API key corresponding to the desired CWork user.

  • The password field of the Authorization header shall be ignored.

To obtain the API Key corresponding to the CWork user, please go to the user management panel (Tools > Preferences > ‘User and groups management’), double-click on the desired user and copy the content of the API Key field.

HTTPS

As from v1.2 CWork’s API can work either over HTTP or HTTPS. Note that it cannot work on both protocols simultaneously. Default will be HTTPS.

In this case, the only purpose of using HTTPS is communication encryption so self-signed certificates are used. Make sure to disable certificate verification on your client.

To disable HTTPS, please go to CWork’s engine preferences panel (Tools > Preferences > ‘Communication Services’), uncheck the HTTPS checkbox and apply changes. You will need to restart smmCApi.

API versioning

You can specify witch API you want to query by adding the version identifier in the HTTP Accept Header. Here is an example :

Accept: application/json+v1

Here is the matrix of CWork’s version and API version availability.

CWork version Embedded API version
<8.24 none
8.24 v1.0
8.24.1 v1.1
8.25 v1.2
8.25.1 v1.3
9.0 v1.4
9.1.3 v1.5
9.2 v1.6
9.2.1 v1.7
9.3.1 v1.8
9.3.2 v1.9
9.6.3 v1.10
9.7 v1.11
9.7.1 v1.12
9.7.2 v1.13
9.8 v1.14
9.8.1 v1.15

Pagination

To avoid returning too big responses, some resources of this API include URI parameters-based pagination. Example: Documents list

The limit parameter will allow you to indicate the maximum item count you want in the resource list. If you omit this parameter, a default value will be used based on the resource. NB: the limit value will be capped to a fixed value based on the resource.

The page parameter will allow you to specify which page of items you want to get. Example: if you set limit to 100 and page to 3 you will get items from 200 to 299.

Error codes

CWork uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a charge failed, etc.), and codes in the 5xx range indicate an internal error with CWork server.
Additionally, we will provide you an Error code and a human-readable message providing more details about the error.

Here is the list of the currently existing errors :

Error code Message
1001 Function is not Allowed
1002 Version %s is not available
1003 No version selected. Please request a specific version
1004 Bad Request
1005 Paramaters must be a handle
1006 A function name is required
1007 A handle is required for this function.
1008 Method Not Allowed.
1009 Missing required parameter
1010 Error in parameters
1011 A provided date-and-time value does not respect the ISO8601 date-and-time format
1012 Impossible to join RemoteDNC engine on the network
1013 The specified station is not assigned to monitor mode
2001 No JPG image is associated with this station [Obsolete after V1.3 if no image available we transmit a default image]
2002 No PNG image is associated with this station [Obsolete after V1.3 if no image available we transmit a default image]
2003 This station is not available or does not exist
2004 Ressource not found.
2005 This state does not exist
2006 This state is archived
2007 This station is not in MDC mode
2008 There is no document found with this ID
2009 There is no version found with this document ID
2010 Required fields have been omitted in your POST request body
2011 The Reference field for a document cannot be empty
2012 Document already exists
2013 There is no version found with this version ID
2014 The version identified by the verid provided does not belong to the document identified by the provided docid
2015 The specified file has not been found in the exchange folder
2016 An internal error occured while submitting the version
2017 The provided MD5 differs from the server-side processed MD5 hash. There might be an issue with the file integrity
2018 Document not found
2019 Extension not supported by the station
2020 This status is already assigned to the station
2021 The state is not included in the station scenario
2022 Timeout error appears during the change of state process
2023 Conflict detected during the change of state process. The state may have changed despite the error
2024 Send ressource returned an error
2025 Remote deletion ressource returned an error
3001 No license activate
4000 Unexpected Error

About data types

This section will describe all you have to know about the data formats we use and how to interpret them. We will try to be as consistent and predictable as possible regarding the use of these data types.

Strings

All strings within CWork’s API are UTF-8 encoded.

Dates & times

All dates within this API will be provided as ISO8601 format including all date time and time zone designators. Here is an example :

2015-06-30T17:19:00.000Z

This example shows the date format for June the 30th, 2015 at 5:19 PM in the UTC time zone.

The timezone is strictly the same as the timezone configured on the machine hosting the API.

Take the following returned body as an example :

{
    "LastPing" : "2023-06-30T17:19:00+01:00"
}

The server is as we see located in the GMT+1 timezone. For example, in France.

If the server is located in Shanghai, you would get :

{
    "LastPing" : "2023-06-30T17:19:00+08:00"
}

As the Shanghai’s timezone is GMT+8.

This way you can use the API and build an app usable all around the world without taking time zones in consideration (as long as your code handles it automatically).

Durations

All durations within this API will be provided in seconds.

Colors

All colors within this API will be described in hexadecimal (HEX) format. Here are a few examples of common colors

Color Hex code
Blue #0000FF
Red #FF0000
Yellow #FFFF00
White #FFFFFF
Black #000000
Green #00FF00

Files

All files transmitted via the API (inbound or outbound) will be exchanged in a common folder in CWork’s working directory under /Temp/API-io/. CApi will automatically create this folder at startup if it doesn’t exist.

For example, when making a GET request to the version endpoint with the include_file parameter set to true, the system will copy the desired file in /Temp/API-io/ and retrieve the temporal name in the JSON response body along with the MD5 hash of the file. The client application will then be able to get it from here and check its integrity.

It’s the client application responsibility to delete the file in /Temps/API-io/ when it’s no longer used. If it’s not, then the system will delete it after 10 minutes.

Users and Groups

Resources related to CWork’s users, groups and permissions

User

GET /users/7
Responses200
Headers
Content-Type: application/json
Body
{
  "Handle": 3,
  "Login": "Operator",
  "Name": "Operator",
  "Mail": "operator@smcom.com",
  "Phone": "+33389280280",
  "Group": "Operators",
  "GroupID": 4,
  "Visible": false
}

View a user detail
GET/users/{user_id}

Available from : v1.10

license required : any

A user object has the following attributes:

Attribute name Description
Handle Unique identifier. Also known as ‘user_id’
Login The login of the user
Name The name of the user
Mail The email address associated with the user.
Phone The phone number associated with the user.
Group The name of the group the user belongs to.
GroupID Unique identifier of the group the user belongs to.
Visible Whether or not the user should be shwon in the login menu dropdown list.
URI Parameters
HideShow
user_id
number (required) Example: 7

ID of the user


Users list

GET /users
Responses200
Headers
Content-Type: application/json
Body
[
    {
        "Handle": 1,
        "Name": "Administrator",
        "Mail": "",
        "Phone": ,
        "Group": "Administrators",
        "GroupID": 1,
        "Visible": false
    },
    {
        "Handle": 4,
        "Name": "APIUser",
        "Mail": "",
        "Phone": ,
        "Group": "Administrators",
        "GroupID": 1,
        "Visible": false
    },
    {
        "Handle": 2,
        "Name": "Method",
        "Mail": "",
        "Phone": ,
        "Group": "Methods",
        "GroupID": 3,
        "Visible": false
    },
    {
        "Handle": 3,
        "Name": "Operator",
        "Mail": "",
        "Phone": ,
        "Group": "Operators",
        "GroupID": 4,
        "Visible": false
    }
]

List all users
GET/users

Available from : v1.10

license required : any


Group

GET /groups/1
Responses200
Headers
Content-Type: application/json
Body
{
  "Groups": [
    {
      "GroupId": "1",
      "GroupName": "Administrateurs",
      "CanManageTransfertHistory": "1",
      "CanCreateDoc": "1",
      "CanEditDoc": "1",
      "CanModifyProperty": "1",
      "CanProtectDoc": "1",
      "CanArchiveDoc": "1",
      "CanDelDoc": "1",
      "CanDelVersion": "1",
      "CanRenameDoc": "1",
      "CanChangeIndexVer": "1",
      "CanChangeComVer": "1",
      "CanChangeStatusVer": "1",
      "CanCertificatDoc": "1",
      "CanImportDoc": "1",
      "CanExportDoc": "1",
      "CanCreateFolder": "1",
      "CanDeleteFolder": "1",
      "CanRenameFolder": "1",
      "CanCreateAliasFolder": "1",
      "CanModifColName": "1",
      "CanSendDoc": "1",
      "CanCustomSendDoc": "1",
      "CanCopyDoc": "1",
      "CanAliasDoc": "1",
      "CanFusionDoc": "1",
      "CanReceiveDoc": "1",
      "CanCompareDoc": "1",
      "CanChangeCncOpt": "1",
      "CanChangeMainOpt": "1",
      "CanChangePass": "1",
      "CanShowHisto": "1",
      "DoNotShowVer": "0",
      "CanAddDoc": "1",
      "CanShowMaintenance": "1",
      "CanActivDeactivCom": "1",
      "CanChangLang": "1",
      "CanShowTrace": "1",
      "CanRestrictDoc": "1",
      "CanQuitMoteur": "1",
      "CanQuickSave": "0",
      "ReOpenVer": "0",
      "CanManageMoteur": "1",
      "CanRestartMoteur": "1",
      "CanShowSpeChar": "1",
      "CanShowCumul": "1",
      "CanAddHisto": "1",
      "CanDelHisto": "1",
      "CanChangeHisto": "1",
      "CanRedimHisto": "1",
      "CanExportHisto": "1",
      "CanChangeState": "1",
      "CanForceAutoState": "1",
      "CanShowOfOp": "1",
      "CanEditOf": "1",
      "CanAddOf": "1",
      "CanDeleteOf": "1",
      "CanEditOp": "1",
      "CanAddOp": "1",
      "CanDeleteOp": "1",
      "CanAddOpPeriod": "1",
      "CanEditOpPeriod": "1",
      "CanDeleteOpPeriod": "1",
      "CanShowPeriod": "1",
      "CanShowProdOf": "1",
      "CanShowCal": "1",
      "CanEditCal": "1",
      "CanShowReport": "1",
      "CanEditReport": "1",
      "ScenarioName": "",
      "StatusFilter": "",
      "StatusCanChange": "",
      "StationAllow": "",
      "StatusNotCertif": "",
      "UseCwo": "1",
      "UseCti": "1"
    }
  ]
}

View a group detail
GET/groups/{group_id}

Available from : v1.10

license required : any

A group object has the following attributes:

Attribute name Description
GroupId Group Id
GroupName Group Name
CanManageTransfertHistory Can remove flags in the movebox
CanCreateDoc Can create new documents
CanEditDoc Can edit documents
CanModifyProperty Can edit document properties
CanProtectDoc Can protect a document
CanArchiveDoc Can archive a document
CanDelDoc Can delete documents in program list
CanDelVersion Can delete document versions
CanRenameDoc Can rename documents
CanChangeIndexVer Can change version hint
CanChangeComVer Can change version comments
CanChangeStatusVer Can change version statuses
CanCertificatDoc Can certify documents
CanImportDoc Can import documents
CanExportDoc Can export documents
CanCreateFolder Can create folders
CanDeleteFolder Can delete folders
CanRenameFolder Can rename folders
CanCreateAliasFolder Can create folder aliases
CanModifColName Can edit column headers
CanSendDoc Can send documents
CanCustomSendDoc Can send partial documents
CanCopyDoc Can copy documents
CanAliasDoc Can create document aliases
CanFusionDoc Can merge documents
CanReceiveDoc Can receive documents
CanCompareDoc Can compare documents
CanChangeCncOpt Can set up CNCs and workbenches
CanChangeMainOpt Can change main options
CanChangePass Can change password
CanShowHisto Can see the Histo page
DoNotShowVer Do not show versions when opening a document
CanAddDoc Can add related documents
CanShowMaintenance Can access maintenance tools
CanActivDeactivCom Can enable and disable COM from CN
CanChangLang Can change language
CanShowTrace Can see item traceability
CanRestrictDoc Can restrict a program to several CNCs
CanQuitMoteur Can stop engines
CanQuickSave Can save quickly
ReOpenVer Reopening of versions after editing
CanManageMoteur Can handle Engines
CanRestartMoteur Can restart engines
CanShowSpeChar Can see special characters
CanShowCumul Can view the aggregation
CanAddHisto Can add a state in the state histories
CanDelHisto Can Delete a state in the state histories
CanChangeHisto Can change a state in the state histories
CanRedimHisto Can resize a state in state histories
CanExportHisto Export the aggregation to Excel
CanChangeState Change machine state
CanForceAutoState Can force automatic state
CanShowOfOp Can see manufacturing orders / jobs
CanEditOf Can edit manufacturing orders
CanAddOf Can add manufacturing orders
CanDeleteOf Can delete manufacturing orders
CanEditOp Can edit jobs
CanAddOp Can add jobs
CanDeleteOp Can remove jobs
CanAddOpPeriod Can add jobs periods
CanEditOpPeriod Can edit jobs periods
CanDeleteOpPeriod Can delete jobs periods
CanShowPeriod Can see jobs periods
CanShowProdOf Can see manufacturing orders productivity
CanShowCal Can see machine calendar
CanEditCal Can edit machine calendar
CanShowReport Can view reports
CanEditReport Can edit reports
ScenarioName Scenario name related to group users
StatusFilter List of statuses visible to group users
StatusCanChange List of statuses to which a version can be certified
StationAllow List of machines accessible by group users
StatusNotCertif List of certifiable statuses by group users
UseCwo Activation status of the DNC Module for group users
UseCti Activation status of the PROD Module for group users
URI Parameters
HideShow
group_id
number (required) Example: 1

ID of the group


Groups list

GET /groups
Responses200
Headers
Content-Type: application/json
Body
{
  "Groups": [
    {
      "GroupId": "1",
      "GroupName": "Administrateurs",
      "CanManageTransfertHistory": "1",
      "CanCreateDoc": "1",
      "CanEditDoc": "1",
      "CanModifyProperty": "1",
      "CanProtectDoc": "1",
      "CanArchiveDoc": "1",
      "CanDelDoc": "1",
      "CanDelVersion": "1",
      "CanRenameDoc": "1",
      "CanChangeIndexVer": "1",
      "CanChangeComVer": "1",
      "CanChangeStatusVer": "1",
      "CanCertificatDoc": "1",
      "CanImportDoc": "1",
      "CanExportDoc": "1",
      "CanCreateFolder": "1",
      "CanDeleteFolder": "1",
      "CanRenameFolder": "1",
      "CanCreateAliasFolder": "1",
      "CanModifColName": "1",
      "CanSendDoc": "1",
      "CanCustomSendDoc": "1",
      "CanCopyDoc": "1",
      "CanAliasDoc": "1",
      "CanFusionDoc": "1",
      "CanReceiveDoc": "1",
      "CanCompareDoc": "1",
      "CanChangeCncOpt": "1",
      "CanChangeMainOpt": "1",
      "CanChangePass": "1",
      "CanShowHisto": "1",
      "DoNotShowVer": "0",
      "CanAddDoc": "1",
      "CanShowMaintenance": "1",
      "CanActivDeactivCom": "1",
      "CanChangLang": "1",
      "CanShowTrace": "1",
      "CanRestrictDoc": "1",
      "CanQuitMoteur": "1",
      "CanQuickSave": "0",
      "ReOpenVer": "0",
      "CanManageMoteur": "1",
      "CanRestartMoteur": "1",
      "CanShowSpeChar": "1",
      "CanShowCumul": "1",
      "CanAddHisto": "1",
      "CanDelHisto": "1",
      "CanChangeHisto": "1",
      "CanRedimHisto": "1",
      "CanExportHisto": "1",
      "CanChangeState": "1",
      "CanForceAutoState": "1",
      "CanShowOfOp": "1",
      "CanEditOf": "1",
      "CanAddOf": "1",
      "CanDeleteOf": "1",
      "CanEditOp": "1",
      "CanAddOp": "1",
      "CanDeleteOp": "1",
      "CanAddOpPeriod": "1",
      "CanEditOpPeriod": "1",
      "CanDeleteOpPeriod": "1",
      "CanShowPeriod": "1",
      "CanShowProdOf": "1",
      "CanShowCal": "1",
      "CanEditCal": "1",
      "CanShowReport": "1",
      "CanEditReport": "1",
      "ScenarioName": "",
      "StatusFilter": "",
      "StatusCanChange": "",
      "StationAllow": "",
      "StatusNotCertif": "",
      "UseCwo": "1",
      "UseCti": "1"
    }
  ]
}

List all groups
GET/groups

Available from : v1.10

license required : any


Station

Resources related to CWork’s stations (Also known as ‘CNC’).

Station

GET /stations/7
Responses200
Headers
Content-Type: application/json
Body
{
  "Handle": 7,
  "Name": "HSC70",
  "Description": "",
  "Disabled": false,
  "DNCMode": true,
  "MDCMode": true,
  "Workshop": "Building A",
  "DNCgroup": "HSCGroup",
  "MDCGroups": [
    "Milling",
    "Line4"
  ]
}

View a station detail
GET/stations/{station_id}

Available from : v1.0

license required : any

A station object has the following attributes:

Attribute name Description
Handle Unique identifier. Also known as ‘station_id’
Name The name of the station
Description The description of the station
Disabled Wether or not the station has been disabled.
DNCMode Wether or not the DNC mode has been enabled on the station.
MDCMode Wether or not the MDC mode has been enabled on the station.
Workshop Name of the virtual CWork workshop where the station is.
DNCGroup Name of the DNC group the station belongs to.
MDCGroups An array of the MDC groups the station belongs to.
URI Parameters
HideShow
station_id
number (required) Example: 7

ID of the station


Station

GET /stations/7/hasimg
Responses200
Headers
Content-Type: application/json
Body
{
  "Hasimage": true
}

Check if an image is linked to the station
GET/stations/{station_id}/hasimg

Available from : v1.4

license required : any

The response attribute is:

Attribute name | Description

Hasimage Whether the station has an image linked.
URI Parameters
HideShow
station_id
number (required) Example: 7

ID of the station


Station images

Retrieve the station’s image as a JPG or PNG file stream.

GET /stations/7/img?json=false
Responses200200
Headers
Content-Type: image/jpeg
Body
<JPG File>
Headers
Content-Type: image/png
Body
<PNG File>

Get station picture as jpg or png
GET/stations/{station_id}/img?json=false

Available from : v1.4 *If no image is linked to the station a default image is transmit *Maximum size is 350px * 350px

license required : any

URI Parameters
HideShow
station_id
number (required) Example: 7

ID of the station


Station list

GET /stations
Responses200
Headers
Content-Type: application/json
Body
[
  {
    "Handle": 7,
    "Name": "HSC70",
    "Description": "",
    "Disabled": false,
    "DNCMode": true,
    "MDCMode": true,
    "Workshop": "Building A",
    "DNCgroup": "HSCGroup",
    "MDCGroups": [
      "Milling",
      "Line4"
    ]
  },
  {
    "Handle": 8,
    "Name": "DMU50",
    "Description": "",
    "Disabled": false,
    "DNCMode": true,
    "MDCMode": true,
    "Workshop": "Building A",
    "DNCGroup": "DMU50",
    "MDCGroups": [
      "Line3"
    ]
  }
]

List all stations
GET/stations

Available from : v1.0

license required : any


Station KPIs

Key performance indicators of a station.

GET /stations/7/kpi?dstart=2015-06-20T17:19:00.000Z&dend=2015-06-30T17:19:00.000Z:00
Responses200
Headers
Content-Type: application/json
Body
{
  "Times": {
    "AT": 4678489,
    "OT": 2278489,
    "PPT": 578489,
    "RT": 438489,
    "NRT": 278489,
    "FPT": 118484,
    "FT": 22455,
    "MTBF": 21134,
    "MTTR": 5678
  },
  "Rates": {
    "TEEP": 0.45,
    "GEE": 0.6,
    "OEE": 0.68,
    "Performance": 0.9,
    "Quality": 0.95,
    "Availability": 0.8,
    "Requisition": 0.6,
    "Load": 0.8,
    "Involvement": 0.9,
    "HardwareAvailability": 0.98
  }
}

Get station KPIs
GET/stations/{station_id}/kpi{?dstart,dend}

Available from : v1.3

license required : monitor

Station KPIs contain the following information.

Attribute name Description
Times All time KPIs expressed in seconds.
Rates All rates KPIs expressed in percents.

Times :

Attribute name Description NFE60-182 Terminology
AT All time included in the selected period (24/7) Temps total
OT Opening time in CNC calendar. Temps d’ouverture
PPT Planned production time. Temps requis
RT Run Time. Temps de fonctionnement
NRT Net Run Time Temps net
FPT Fully Productive Time Temps utile
FT Failure Time Temps de panne
MTBF Mean Time Between Failure. Temps moyen entre les pannes
MTTR Mean Time To Repair. Temps moyen de dépannage

Rates :

Attribute name Description NFE60-182 Terminology
TEEP Total Effective Equipment Performance Taux de rendement économique (TRE)
GEE Global Equipment Effectiveness Taux de rendement global (TRG)
OEE Overall Equipment Effectiveness Taux de rendement synthétique (TRS)
Performance Performance rate Taux de performance (TP)
Quality Quality rate Taux de qualité (TQ)
Availability Availaibility rate Taux de disponibilité opérationelle (DO)
Requisition NC Taux de réquisition
Load NC Taux de charge
Involvement NC Taux stratégique d’engagement
HardwareAvailability NC Taux de disponibilité matérielle

For any question regarding KPIs terminology or calculations, please read OEE rules or ask our team.

URI Parameters
HideShow
station_id
number (required) Example: 7

ID of the station

dstart
datetime (required) Example: 2015-06-20T17:19:00.000Z

Period’s start selection

dend
datetime (optional) Example: 2015-06-30T17:19:00.000Z:00

Period’s end selection (default = now)


Get station running programs

Retrieve the running programs of a station on a period.

GET /stations/7/runningprograms?dstart=2018-08-28T08:30:00.000Z&dend=2018-08-29T10:30:00.000Z
Responses200
Headers
Content-Type: application/json
Body
[
    {
        "Name" : "PGM0001",
        "Context" : "BOUCHON_AR",
        "StartDate" : "2018-08-28T08:06:20.000Z",
        "EndDate" : "2018-08-28T:09:20.000Z"
    },
    {
        "Name" : "PGM0014",
        "Context" : "COLONNE",
        "StartDate" : "2018-08-29T10:00:20.000Z",
        "EndDate" : "2018-08-29T11:31:19.000Z",
    }
]

Get station running programs
GET/stations/{station_id}/runningprograms{?dstart,dend}

Available from : v1.11

license required : monitor

Running programs contains the following information.

Attribute name Description
Name Name of the runnning program
Context Context of the runnning program
StartDate Start date and time of the runnning program
EndDate End date and time of the runnning program
URI Parameters
HideShow
station_id
number (required) Example: 7

ID of the station

dstart
datetime (required) Example: 2018-08-28T08:30:00.000Z

Period start selection

dend
datetime (optional) Example: 2018-08-29T10:30:00.000Z

Period end selection (default = now)


Get station selected programs

Retrieve the selected programs of a station on a period.

GET /stations/7/selectedprograms?dstart=2018-08-28T08:30:00.000Z&dend=2018-08-29T10:30:00.000Z
Responses200
Headers
Content-Type: application/json
Body
[
    {
        "Name" : "PGM0001",
        "Context" : "BOUCHON_AR",
        "StartDate" : "2018-08-28T08:06:20.000Z",
        "EndDate" : "2018-08-28T:09:20.000Z"
    },
    {
        "Name" : "PGM0014",
        "Context" : "COLONNE",
        "StartDate" : "2018-08-29T10:00:20.000Z",
        "EndDate" : "2018-08-29T11:31:19.000Z",
    }
]

Get station selected programs
GET/stations/{station_id}/selectedprograms{?dstart,dend}

Available from : v1.11

license required : monitor

Selected programs contain the following information.

Attribute name Description
Name Name of the selected program
Context Context of the selected program
StartDate Start date and time of the selected program
EndDate End date and time of the selected program
URI Parameters
HideShow
station_id
number (required) Example: 7

ID of the station

dstart
datetime (required) Example: 2018-08-28T08:30:00.000Z

Period start selection

dend
datetime (optional) Example: 2018-08-29T10:30:00.000Z

Period end selection (default = now)


Get station alarms

Retrieve the alarms of a station for a period.

GET /stations/7/alarms?dstart=2018-08-28T10:30:00.000Z&dend=2018-08-29T14:30:00.000Z
Responses200
Headers
Content-Type: application/json
Body
[
    {
        "Code" : "0015",
        "Message" : "TOO MANY SIMULTANEOUS AXIS",
        "StartDate" : "2018-08-28T08:06:20.000Z",
        "EndDate" : "2018-08-28T12:09:20.000Z"
    },
    {
        "Code" : "0060",
        "Message" : "SEQUENCE NUMBER NOT FOUND",
        "StartDate" : "2018-08-29T09:00:34.000Z",
        "EndDate" : "2018-08-29T11:31:19.000Z",
    },
    {
        "Code" : "5010",
        "Message" : "END OF RECORD",
        "StartDate" : "2018-09-29T10:00:45.000Z",
        "EndDate" : "2018-09-29T15:01:11.000Z",
    }
]

Get station alarms
GET/stations/{station_id}/alarms{?dstart,dend}

Available from : v1.6

license required : monitor

Alarms contain the following information.

Attribute name Description
Code Code of the alarm
Message Informative message about the alarm
StartDate Start date and time of the alarm
EndDate End date and time of the alarm
URI Parameters
HideShow
station_id
number (required) Example: 7

ID of the station

dstart
datetime (required) Example: 2018-08-28T10:30:00.000Z

Period start selection

dend
datetime (optional) Example: 2018-08-29T14:30:00.000Z

Period end selection (default = now)


Send

Send a requested document on the station target folder.
Supported protocols : FOCAS Heidenhain LSV2/Ethernet SMBClient FTPClient RS232 SMB

POST /stations/4/send/
Requestsexample 1example 2
Headers
Content-Type: application/json
Body
{
    "DocumentName": "1500",
    "DocExtension": "MPF",
    "SourceFolder": "folder/path",
    "DestinationFolder": "random",
    "Override": true,
    "DestinationFolderMode": override
}
Responses200
Headers
Content-Type: application/json
Body
[]
Headers
Content-Type: application/json
Body
{
  "DocumentName": "prg1",
  "DocExtension": "cnc",
  "SourceFolder": "ImportFAO/",
  "AsynchronousMode": true,
  "WaitBeforQuerySendStatus": 5000,
  "Override": true
}
Responses200
Headers
Content-Type: application/json
Body
{
  "GUID": "{FFB963F8-DADF-4127-939D-D7267F110137}",
  "TimeTag": "03/09/2024 11:42:22",
  "Status": "0: File Sent "
}

Send document
POST/stations/{station_id}/send/

Available from : v1.14

license required : dnc

Your request will have to contain the following information.

Attribute name Description
DocumentName Name of the requested document.
DocExtension Extension of the document.
SourceFolder Source in-app folder where the document is located.(optional)(The default value is the root folder)
DestinationFolder Destination folder where the requested document will be placed.(optional)
Override Set true to override the document on the destination folder.(optional)(The default value is false)
DestinationFolderMode What to do with DestinationFolder append or override.(optional)(The default value is append)
AsynchronousMode Set true to send in asynchronous mode.(optional)(The default value is false)
WaitBeforQuerySendStatus Time API wait to check Send status in asynchronous mode after start send and before return.(optional)(The default value is 0)

DocumentName,DocExtension are required fields in your request. All other fields may be omitted.

‘DestinationFolderMode’, available from v1.15, is used for LSV2 and Fanuc supporting cnc_dwnstart4.

If append SourceFolder is added to folder configured in Cwork.

If override folder configured in Cwork will be overrided by SourceFolder parameter.

URI Parameters
HideShow
station_id
number (required) Example: 4

ID of the station


MultiSend

Send a requested documents on the station.
Supported protocols : RS232

POST /stations/4/multisend/
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "Documents": [
    {
      "DocumentName": "1500",
      "DocExtension": "MPF",
      "SourceFolder": "folder/path"
    },
    {
      "DocumentName": "prg1",
      "DocExtension": "cnc",
      "SourceFolder": "folder/path"
    }
  ]
}
Responses200
Headers
Content-Type: application/json
Body
[]

Send document
POST/stations/{station_id}/multisend/

Available from : v1.14

license required : dnc

Your request will have to contain the following information.

Attribute name Description
DocumentName Name of the requested document.
DocExtension Extension of the document.
SourceFolder Source in-app folder where the document is located.(optional)(The default value is the root folder)

DocumentName,DocExtension are required fields in your request. All other fields may be omitted.

URI Parameters
HideShow
station_id
number (required) Example: 4

ID of the station


Change state

Change the current state of a station.

POST /stations/4/status_history
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "State": 0,
  "Comment": "Restarting production"
}
Responses200
Headers
Content-Type: application/json
Body
{
  "State": {
    "Handle": 0,
    "Name": "Production",
    "Color": "#87D37C",
    "OEECategory": 4,
    "ParentHandle": null,
    "CloseDay": false,
    "ProdPercent": true,
    "UsePercent": true
  },
  "LastTop": "2019-06-19T14:41:25.000Z",
  "Comment": "Restarting production"
}

Change the current state of a station
POST/stations/{station_id}/status_history

Available from : v1.9

license required : monitor

Your request will have to contain the following fields :

Attribute name Description
State New state’s handle.
Comment Comment about the new state. (optional)

State is a required field in your request. Comment may be omitted.

URI Parameters
HideShow
station_id
number (required) Example: 4

ID of the station


Replace current state

Replace the current state of a station.

POST /stations/4/replace_curent_state
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "State": 0,
  "Comment": "Restarting production"
}
Responses200
Headers
Content-Type: application/json
Body
{
  "State": {
    "Handle": 0,
    "Name": "Production",
    "Color": "#87D37C",
    "OEECategory": 4,
    "ParentHandle": null,
    "CloseDay": false,
    "ProdPercent": true,
    "UsePercent": true
  },
  "LastTop": "2019-06-19T14:41:25.000Z",
  "Comment": "Restarting production"
}

Replace the current state of a station
POST/stations/{station_id}/replace_curent_state

Available from : v1.14

license required : monitor

Your request will have to contain the following fields :

Attribute name Description
State Target handle for the new state.
Comment Comment about the new state. (optional)

State is a required field in your request. Comment may be omitted.

If Commentis omitted and two states are merged then comment will be “comment state one” " + " comment state two".

If Commentis omitted and no merge then comment will not be replaced.

If Commentis not omitted then the comment will be replaced by the one provided.

URI Parameters
HideShow
station_id
number (required) Example: 4

ID of the station


Force auto state

Apply auto state of a station.

POST /stations/4/force_auto_state
Requestsexample 1
Headers
Content-Type: application/json
Body
{}
Responses200
Headers
Content-Type: application/json
Body
{
  "State": {
    "Handle": 0,
    "Name": "Production",
    "Color": "#87D37C",
    "OEECategory": 4,
    "ParentHandle": null,
    "CloseDay": false,
    "ProdPercent": true,
    "UsePercent": true
  },
  "LastTop": "2019-06-19T14:41:25.000Z",
  "Comment": "Restarting production"
}

Force auto state of a station
POST/stations/{station_id}/force_auto_state

Available from : v1.14

license required : monitor

An empty body is required

URI Parameters
HideShow
station_id
number (required) Example: 4

ID of the station


State

Resources related to CWork’s station state definitions.

State

GET /states/4
Responses200
Headers
Content-Type: application/json
Body
{
  "Handle": 4,
  "Name": "Disengagement",
  "Color": "#808080",
  "OEECategory": 1,
  "ParentHandle": null,
  "CloseDay": true,
  "ProdPercent": false,
  "UsePercent": false
}

View a state definition
GET/states/{state_id}

Available from : v1.0

license required : any

A state object has the following attributes:

Attribute name Description
Handle Unique identifier. Also known as ‘state_id’.
Name The name of the state.
Color Color of the state (Hexadecimal format).
TPM State category in the OEE norm.
ParentHandle Unique identifier of the state’s parent state.
CloseDay Wether or not the state ends the day if placed last.
ProdPercent Wether or not counting in the production percentage.
UsePercent Wether or not counting in the usage percentage.
URI Parameters
HideShow
state_id
number (required) Example: 4

ID of the state


State list

GET /states
Responses200
Headers
Content-Type: application/json
Body
[
  {
    "Handle": 0,
    "Name": "Production",
    "Color": "#008000",
    "OEECategory": 4,
    "ParentHandle": null,
    "CloseDay": false,
    "ProdPercent": true,
    "UsePercent": true
  },
  {
    "Handle": 1,
    "Name": "Breakdown",
    "Color": "#FF0000",
    "OEECategory": 2,
    "ParentHandle": null,
    "CloseDay": false,
    "ProdPercent": false,
    "UsePercent": true
  },
  {
    "Handle": 2,
    "Name": "Setting",
    "Color": "#0000FF",
    "OEECategory": 2,
    "ParentHandle": null,
    "CloseDay": false,
    "ProdPercent": false,
    "UsePercent": true
  },
  {
    "Handle": 3,
    "Name": "Waiting",
    "Color": "#FFFF00",
    "OEECategory": 3,
    "ParentHandle": null,
    "CloseDay": false,
    "ProdPercent": false,
    "UsePercent": true
  },
  {
    "Handle": 4,
    "Name": "Disengagement",
    "Color": "#808080",
    "OEECategory": 1,
    "ParentHandle": null,
    "CloseDay": true,
    "ProdPercent": false,
    "UsePercent": false
  }
]

List all states
GET/states

Available from : v1.0

license required : any


Station status

Resources describing the real time status of a stations. This is useful if you want to build a dashboard, for example.

Station status

GET /station_statuses/4
Responses200
Headers
Content-Type: application/json
Body
{
    "Reference": "C138568-304",
    "Order": "588558",
    "Job": "30",
    "JobCycleTime": "5894",
    "PartCount": "50",
    "State": {
        "Handle": 2,
        "Name": "Setting",
        "Color": "#0000FF",
        "OEECategory": 2,
        "ParentHandle": null,
        "CloseDay": false,
        "ProdPercent": false,
        "UsePercent": true
        sss},
    "LastTop": "2015-10-29T16:58:00.000+01:00",
    "Comment": "Setting for next job (588558-30)",
    "Alarms": [
        {
            "Code": "0139",
            "Message": "CANNOT CHANGE PMC CONTROL AXIS",
            "StartDate": "2018-07-31T09:08:20.000+01:00"
        },
        {
            "Code": "0146",
            "Message": "ILLEGAL USE OF G-CODE",
            "StartDate": "2018-07-31T10:09:05.000+01:00"
        }
    ],
    "RunningProgram": {
        "Name": "PGM001"
    },
    "SelectedProgram": {
        "Name": "PGM001-2"
    },
    "TotalParts": 892,
    "PartsSinceReset": 50
}

View a station's status
GET/station_statuses/{station_id}

Available from : v1.0

In the version v1.12 or later, the parameter station_id is no longer required. Omitting it will allow getting all station statuses

license required : monitor

A station object has the following attributes:

Attribute name Description
Handle The handle of the CNC
Reference Part reference associated with the currently running Order
Order The name of the currently running Order
Job The name of the currently running Job
JobCycleTime The reference cycle time of the currently running Job in seconds
PartCount The number of parts to realise for the currently running Job
State State object representing the current state of the station.
LastTop Date of the last state change.
Comment Comment of the last state change. v1.1
Alarms The active alarms of the station. v1.6
RunningProgram The running program of the station. v1.11
SelectedProgram The selected program of the station. v1.11
TotalParts The total machined parts of the CNC. v1.12
PartsSinceReset The machined parts of the CNC since the last reset. v1.12

SelectedProgram field has been removed in v1.11 and replaced by RunningProgram and SelectedProgram.

URI Parameters
HideShow
station_id
number (optional) Example: 4

ID of the station


Station protocols

Resources describing the real time protocols of a stations. This is useful if you want to build a dashboard, for example.

Station protocols

GET /stations/4/returnCNCProtocol
Responses200
Headers
Content-Type: application/json
Body
{
  "message": "FTP"
}

View a station's protocols
GET/stations/{station_id}/returnCNCProtocol

Available from : v1.6

In the version v1.12 or later, the parameter station_id is no longer required. Omitting it will allow getting all station statuses

Licence required : monitor

A station object has the following attributes:

Attribute name Description
message The transmission protocols of the CNC

SelectedProgram field has been removed in v1.11 and replaced by RunningProgram and SelectedProgram.

URI Parameters
HideShow
station_id
number (optional) Example: 4

ID of the station


Top list

List all tops.

GET /tops?station=1&startdate=1609455600&enddate=1654034400&nbtopbefore=0&nbtopafter=0&limit=2&page=1
Responses200
Headers
Content-Type: application/json
Body
{
  "Has_more": true,
  "Tops": [
    {
      "topidentifier": 0,
      "topcnchandlefield": 0,
      "topstatehandlefield": 3,
      "topstartdatefield": "2021-06-16T13:58:00.000Z",
      "topcommentfield": "TOP 239998",
      "topenddatefield": "2021-06-16T13:59:00.000Z",
      "topdurationfield": 60
    },
    {
      "topidentifier": 1,
      "topcnchandlefield": 0,
      "topstatehandlefield": 4,
      "topstartdatefield": "2021-06-16T13:59:00.000Z",
      "topcommentfield": "TOP 239999",
      "topenddatefield": "2021-06-16T14:00:00.000Z",
      "topdurationfield": 60
    }
  ]
}

List all tops
GET/tops{?station,startdate,enddate,nbtopbefore,nbtopafter,limit,page}

Available from : v1.10

license required : monitor

The list will be built as follows.

Attribute name Description
Has_more True if there is more pages to be loaded.
Tops List of Top objects

A top represents a CNC state (Production, Idle, Failure, etc.) in the time axis.

Details of the top object :

Attribute name Description
topidentifier The position of each top in the requested top list. This identifier is dynamic as you switch pages.
topcnchandlefield The handle of the CNC on which the state has been recorded.
topstatehandlefield The handle of the recorded state.
topstartdatefield The start date of the top.
topcommentfield The comment of the top, defined manually.
topenddatefield The end date of the top.
topdurationfield The duration of the top, in seconds.
URI Parameters
HideShow
station
integer (required) Example: 1

id of the station owning the tops

startdate
unixtime int64 (required) Example: 1609455600

Start window date (Included) (number of seconds since 1st january 1970 00:00:00 UTC)

enddate
unixtime int64 (required) Example: 1654034400

End window date (Excluded) (number of seconds since 1st january 1970 00:00:00 UTC)

nbtopbefore
integer (optional) Example: 0

NbTop before the first one in windows (default =0)

nbtopafter
integer (optional) Example: 0

NbTop after the last one in windows (default =0)

limit
integer (optional) Example: 2

Count of top per page (default = 3000; max = 3000)

page
integer (optional) Example: 1

Page number (default = 1)


Part count

Resources to manage part count.

Part Count

POST /ResetStationPartCount/4
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "PartCount": 12
}
Responses200
Headers
Content-Type: application/json
Body
[]

Reset Part
POST/ResetStationPartCount/{station_id}

Available from : v1.13

license required : monitor

Reset initial part count value. Your request will have to contain the following fields :

Attribute name Description
PartCount Value of initial part count.
URI Parameters
HideShow
station_id
number (required) Example: 4

ID of the station


Documents and Versions

Resource representing a CWork document.

Document

Access a specific document.

GET /documents/4
Responses200
Headers
Content-Type: application/json
Body
{
  "DocumentId": 7,
  "DocumentIdAlias": 0,
  "Reference": "HSC70",
  "Extension": "MPF",
  "Folder": "",
  "StationId": 17,
  "DisplayStatus": "VALIDATED",
  "DisplayIndex": "A/5",
  "DisplaySize": 13453,
  "Emergency": 2,
  "CDate": "2015-06-28T17:19:00.000Z",
  "MDate": "2015-06-30T17:00:07.000Z",
  "Custom1": "foo",
  "Custom2": "bar",
  "Custom3": "alpha",
  "Custom4": "beta",
  "Custom5": "omega",
  "Protected": true,
  "Archived": false
}

Get Document
GET/documents/{doc_id}

Available from : v1.3

License required : dnc

Documents linked to deleted CNC’s will not be returned.

A document object has the following attributes:

Attribute name Description
DocumentId Unique document identifier. document_id
DocumentIdALias If the current document IS an alias, this identifier points to the referenced document.
Reference The reference of the document in CWork
Extension File extension of the document
StationId Identifier of the station owning the document
Folder Name of the folder holding the document (empty if in station’s root) ex : folder1\
DisplayStatus Status of the current version in display (!!see doc for details!!)
DisplayIndex Index of the current version in display (!!see doc for details!!)
DisplaySize Size of the current version in display (!!see doc for details!!)
Emergency Value of Emergency field in CWork.
CDate Create date of the document.
MDate Last modification date of the document.
Custom1 Value of first custom field (aka : Description)
Custom2 Value of second custom field (aka : Title)
Custom3 Value of third custom field (aka : Subject)
Custom4 Value of fourth custom field (aka : Category)
Custom5 Value of fifth custom field (aka : Manuel index)
Protected true if the document is marked as protected in the software
Archived true if the document is marked as archived in the software
URI Parameters
HideShow
doc_id
number (required) Example: 4

ID of the document


Document list

List all documents.

GET /documents?reference=HSC80&extension=MPF&station=17&limit=50&page=1&recycle_bin=exclude&include_group=false
Responses200
Headers
Content-Type: application/json
Body
{
"Has_more" : false,
"Documents" : [
                {
                    "DocumentId": 7,
                    "DocumentIdAlias" : 0,
                    "Reference": "HSC80",
                    "Extension": "MPF",
                    "Folder": "",
                    "StationId": 17,
                    "DisplayStatus": "VALIDATED",
                    "DisplayIndex": "A/5",
                    "DisplaySize": 13453,
                    "Emergency": 2,
                    "CDate": "2015-06-28T17:19:00.000Z",
                    "MDate": "2015-06-30T17:00:07.000Z",
                    "Custom1": "foo",
                    "Custom2": "bar",
                    "Custom3": "alpha",
                    "Custom4": "beta",
                    "Custom5": "omega",
                    "Protected": true,
                    "Archived": false
                },
                {
                    "DocumentId": 8,
                    "DocumentIdAlias" : 7,
                    "Reference": "HSC80",
                    "Extension": "MPF",
                    "Folder": "random-folder\",
                    "StationId": 17,
                    "DisplayStatus": "TESTING",
                    "DisplayIndex": "B/2",
                    "DisplaySize": 1453,
                    "Emergency": 0,
                    "CDate": "2015-06-28T17:19:00.000Z",
                    "MDate": "2015-06-30T17:00:07.000Z",
                    "Custom1": "foo",
                    "Custom2": "bar",
                    "Custom3": "alpha",
                    "Custom4": "beta",
                    "Custom5": "omega",
                    "Protected": false,
                    "Archived": false
                }
            ]
        }

List all documents
GET/documents{?reference,extension,station,limit,page,recycle_bin,include_group}

Available from : v1.3

The parameter recycle_bin is available from : v1.15

license required : dnc

Documents linked to deleted CNC’s will not be returned.

The list will be built as follows.

Attribute name Description
Has_more True if there is more page to be loaded.
Documents List of Document object

You can filter the list with the following parameters

URI Parameters
HideShow
reference
string (optional) Example: HSC80

Exact reference of the document

extension
string (optional) Example: MPF

File extension of the document

station
integer (optional) Example: 17

id of the station owning the document (we will consider station in the same group)

limit
integer (optional) Example: 50

Count of document per page (default = 200; max = 200)

page
integer (optional) Example: 1

Page number (default = 1)

recycle_bin
string (optional) Example: exclude

Bin filtering - Expected values : exclude : Return documents which are not in the bin, include : Return all documents, only : Return only documents which are in the bin. (default = exclude)

include_group
boolean (optional) Example: false

If set to true, will add documents from CNC of same group. Default is false.


Document custom fields

List all documents.

GET /documents/customFields
Responses200
Headers
Content-Type: application/json
Body
{
  "docnamefield": "Reference",
  "docdescriptionfield": "Description",
  "doctitlefield": "Title",
  "docsubjectfield": "Subject",
  "doccategoryfield": "Category",
  "docindicefield": "Manual Index",
  "doccncfield": "CNC",
  "docfolderfield": "Folder",
  "docextfield": "Extension",
  "docstatusfield": "Status",
  "docprimaryindexfield": "Index",
  "doccncauthorizedfield": "CNC Authorized",
  "docfilesize": "Size",
  "docpkaliasfield": "Alias",
  "docprotectfield": "Protected",
  "docarchivedfield": "Archived",
  "docisattachment": "has an Attachment",
  "docspecialflagfield": "Special Flag",
  "doccdatefield": "Creation date",
  "docmdatefield": "Edit date",
  "docfilesizeValidfield": "Size"
}

List document custom fields
GET/documents/customFields

Available from : v1.16

License required : dnc

In the desktop application, document fields (such as Reference, Folder, etc.) are editable and available depending on the used scenario. This route returns these customized fields (and tags) to keep consistency about your workspace.

The fields returned depend on the scenario the user belongs to.

Attribute name Description
docnamefield Document’s name field
docdescriptionfield Document’s description field
doctitlefield Document’s title field
docsubjectfield Document’s subject field
doccategoryfield Document’s category field
docindicefield Document’s manual index field
doccncfield Document’s CNC field
docfolderfield Document’s folder field
docextfield Document’s extension field
docstatusfield Document’s status field
docprimaryindexfield Document’s Primary Index field
doccncauthorizedfield Document’s Primary Index field
docfilesize Document’s size field
docpkaliasfield Alias tag
docprotectfield Protected tag
docarchivedfield Archived tag
docisattachment Has an attachment tag
docspecialflagfield Special Flag field
doccdatefield Document’s creation date field
docmdatefield Document’s edit date field
docfilesizeValidfield Document’s validated size field

Create a document

POST /documents
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "Reference": "HSC70",
  "StationId": 17,
  "Extension": "MPF",
  "Folder": "",
  "Custom1": "foo",
  "Custom2": "bar",
  "Custom3": "alpha",
  "Custom4": "beta",
  "Custom5": "omega",
  "Protected": false,
  "Archived": false
}
Responses201
Headers
Content-Type: application/json
Body
{
  "DocumentId": 7,
  "Reference": "HSC70",
  "Extension": "MPF",
  "Folder": "",
  "StationId": 17,
  "DisplayStatus": "",
  "DisplayIndex": "",
  "DisplaySize": 0,
  "Emergency": 0,
  "CDate": "2015-06-38T17:19:00.000Z",
  "MDate": "2015-06-38T17:19:00.000Z",
  "Custom1": "foo",
  "Custom2": "bar",
  "Custom3": "alpha",
  "Custom4": "beta",
  "Custom5": "omega",
  "Protected": false,
  "Archived": false
}

Create a document
POST/documents

Available from : v1.3

license required : dnc

Create a new document in the system. You can have the following fields :

Attribute name Description
Reference Target reference for the new document.
StationId Target station identifier for the document.
Extension Extension of the new document.
Folder Folder in which to place the document.
Custom1 Value of first custom field (aka : Description)
Custom2 Value of second custom field (aka : Title)
Custom3 Value of third custom field (aka : Subject)
Custom4 Value of fourth custom field (aka : Category)
Custom5 Value of fifth custom field (aka : Manuel index)
Protected Set to true to mark the document as protected
Archived Set to true to mark the document as Archived

Reference and StationId are required fields in your request. All other fields may be omitted.


Version details

Access a specific version and its details based on its identifier.

You can also access this resource directly by addressing your request to /versions/{ver_id}

GET /documents/27/versions/38?include_file=true
Responses200
Headers
Content-Type: application/json
Body
{
  "VersionId": 38,
  "DocumentId": 27,
  "Status": "VALIDATED",
  "PrimaryIndex": "B",
  "SecondaryIndex": "9",
  "CDate": "2015-06-28T17:19:00.000Z",
  "MDate": "2015-06-30T17:00:07.000Z",
  "RXDate": "2015-05-30T17:00:07.000Z",
  "TXDate": "2015-06-21T17:00:07.000Z",
  "Comment": "foo",
  "Size": 15898,
  "File": {
    "url": "rGBV84pC3a",
    "md5": "60D48FC210A6AF24F9845DBF3645623BFDC793AB"
  }
}

Get version details
GET/documents/{doc_id}/versions/{ver_id}{?include_file}

Available from : v1.3

License required : dnc

A version object has the following attributes:

Attribute name Description
VersionId Unique version identifier. version_id.
DocumentId Unique identifier of the document owning the version.
Status Status associated with the version.
PrimaryIndex Primary index of the version.
SecondaryIndex Secondary index of the version.
CDate Date of creation.
MDate Date of last modification
RXDate Date of reception.
TXDate Date of last send.
Comment Comment on the version.
Size File size in byte of the version.
File Structure holding the download temp file name and a md5 hash to control it’s integrity. Blank if include_file is false. The temp file will be deleted under 10min.
URI Parameters
HideShow
doc_id
number (required) Example: 27

ID of the document object

ver_id
number (required) Example: 38

ID of the version object

include_file
boolean (optional) Example: true

If set to true, will add the url to obtain the file. Default is false.


Download version content

Access a specific version and its content based on its identifier.

You can also access this resource directly by addressing your request to /versions/{ver_id}/download

GET /documents/27/versions/38/download?json=false
Responses200
Headers
Content-Type: application/text
Body
G00 X70.0 Z2.0;
G42;
G70 P100 Q200;
G00 X70.0 Z5.0;
G53 X0.0 Z-210.0 M09;

Get version content
GET/documents/{doc_id}/versions/{ver_id}/download{?json}

Available from : v1.14

license required : dnc

URI Parameters
HideShow
doc_id
number (required) Example: 27

ID of the document object

ver_id
number (required) Example: 38

ID of the version object

json
boolean (optional) Example: false

If set to true, will return a json object with an ASCII code sequence. If false, will return the version’s content in raw (text). Default is true.


Certify a version

Certify a specific version based on its identifier.

You can also access this resource directly by addressing your request to /versions/{ver_id}/certify

GET /documents/27/versions/38/certify
Requestswith the following body
Body
{
    {
      "Comments":"Validating by CAPI",
      "NewStatus":"VALIDATED"
  }
}
Responses200
Headers
Content-Type: application/text
Body
{
    {
      "Comments":"Validating by CAPI",
      "NewStatus":"VALIDATED",
      "VersionId":45 // Contains the edited or added version identifier (depends on the used scenario)
      }
}

Certify a version
GET/documents/{doc_id}/versions/{ver_id}/certify

Available from : v1.16

License required : dnc

Behavior may change depending on the selected scenario. Be advised : The selected scenario will be the user’s.

Attribute name Description
Comments Comments you want to submit on certifying the version (optional)
NewStatus The new status you want the version to have (required).
URI Parameters
HideShow
doc_id
number (required) Example: 27

ID of the document object

ver_id
number (required) Example: 38

ID of the version object


Version list

GET /documents/27/versions
Responses200
Headers
Content-Type: application/json
Body
[
  {
    "VersionId": 38,
    "DocumentId": 27,
    "Status": "VALIDATED",
    "PrimaryIndex": "B",
    "SecondaryIndex": "9",
    "CDate": "2015-06-28T17:19:00.000Z",
    "MDate": "2015-06-30T17:00:07.000Z",
    "RXDate": "2015-05-30T17:00:07.000Z",
    "TXDate": "2015-06-21T17:00:07.000Z",
    "Comment": "foo",
    "Size": 15898,
    "File": null
  },
  {
    "VersionId": 39,
    "DocumentId": 27,
    "Status": "TESTING",
    "PrimaryIndex": "B",
    "SecondaryIndex": "10",
    "CDate": "2015-06-29T17:19:00.000Z",
    "MDate": "2015-06-30T17:00:07.000Z",
    "RXDate": "2015-05-30T17:00:07.000Z",
    "TXDate": "2015-06-21T17:00:07.000Z",
    "Comment": "bar",
    "Size": 15695,
    "File": null
  }
]

List all versions within a document
GET/documents/{doc_id}/versions

Available from : v1.3

license required : dnc

List of Version object

NB: The include_file option is not available when listing all versions of a document. If you want to obtain the file behind a version, make a GET request to /documents/{doc_id}/version/{ver_id} or directly at /versions/{ver_id}

URI Parameters
HideShow
doc_id
number (required) Example: 27

ID of the document


POST /documents/27/versions
Requestswith md5without md5
Headers
Content-Type: application/json
Body
{
  "File": "rGBV84pC38",
  "Md5": "60D48FC210A6AF24F9845DBF3645623BFDC793AB",
  "Comment": "my new version"
}
Responses201
Headers
Content-Type: application/json
Body
{
  "VersionId": 38,
  "DocumentId": 27,
  "Status": "VALIDATED",
  "PrimaryIndex": "B",
  "SecondaryIndex": "9",
  "CDate": "2015-06-28T17:19:00.000Z",
  "MDate": "2015-06-30T17:00:07.000Z",
  "RXDate": "2015-05-30T17:00:07.000Z",
  "TXDate": "2015-06-21T17:00:07.000Z",
  "Comment": "my new version",
  "Size": 15898,
  "File": null
}
Headers
Content-Type: application/json
Body
{
  "File": "rGBV84pC38",
  "Md5": "",
  "Comment": ""
}
Responses201
Headers
Content-Type: application/json
Body
{
  "VersionId": 38,
  "DocumentId": 27,
  "Status": "VALIDATED",
  "PrimaryIndex": "B",
  "SecondaryIndex": "9",
  "CDate": "2015-06-28T17:19:00.000Z",
  "MDate": "2015-06-30T17:00:07.000Z",
  "RXDate": "2015-05-30T17:00:07.000Z",
  "TXDate": "2015-06-21T17:00:07.000Z",
  "Comment": "",
  "Size": 15898,
  "File": null
}

Submit a version
POST/documents/{doc_id}/versions

Available from : v1.3

license required : dnc

Submit a version to the system. Your request will have to contain the following fields :

Attribute name Description
File Name of the temporal file submited to the system.
Md5 Md5 hash allowing us to check the integrity of the transmited file (optional).
Comment Comment to set to the version (optional)
URI Parameters
HideShow
doc_id
number (required) Example: 27

ID of the document


Delete a document version

POST /stations/1/delete_version
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "VersionId": "10"
}
Responses200
Headers
Content-Type: application/json

Delete a specific document version
POST/stations/{station_id}/delete_version

Available from : v1.14

license required : dnc

Delete a document version in the system. You can have the following fields :

Attribute name Description
VersionId Id reference to delete the document version.
URI Parameters
HideShow
station_id
number (required) Example: 1

ID of the station containing the document and its specific version


Delete a document

POST /stations/1/delete_document
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "DocumentId": 3
}
Responses200
Headers
Content-Type: application/json

Delete a document
POST/stations/{station_id}/delete_document

Available from : v1.14

License required : dnc

Delete a document in the system. You can have the following fields :

Attribute name Description
DocumentId Id to delete the document.
URI Parameters
HideShow
station_id
number (required) Example: 1

ID of the station containing the document


Orders & Jobs

order

Return an order from the specified id.

GET /orders/3
Responses200
Headers
Content-Type: application/json
Body
[
  {
    "OrderId": 3,
    "Name": "Order 3",
    "CreationDate": "2023-07-05T11:05:48.000Z",
    "Description": "This is a description for the order 3",
    "PartReference": "1234",
    "Client": "Client1234",
    "CurrentState": -1,
    "Valid": 1,
    "Archived": 0
  }
]

Get an order
GET/orders/{id}

Available from : v1.13

license required : prod

An order object will have the following attributes :

Attribute name Description
OrderId The ID of the order
Name The name of the order
CreationDate The creation date of the order
Description The description of the order
PartReference The reference of the part the order is working on
Client The ID of the linked client
CurrentState The current state of the order (-1: No state, 0: Start, 1: Resuming, 2: Stop, 3: Pause)
Valid Weither the order is valid or not
Archived Weither the order is archived or not
URI Parameters
HideShow
id
number (required) Example: 3

ID of the order


orders

Returns all valid and unarchived orders.

GET /orders
Responses200
Headers
Content-Type: application/json
Body
[
  {
    "OrderId": 1,
    "Name": "Order 1",
    "CreationDate": "2023-07-12T09:42:08.000Z",
    "Description": "This is a description for the order 1",
    "PartReference": "5678",
    "Client": "Client1234",
    "CurrentState": -1,
    "Valid": 1,
    "Archived": 0
  },
  {
    "OrderId": 2,
    "Name": "Order 2",
    "CreationDate": "2023-07-12T09:43:34.000Z",
    "Description": "This is a description for the order 2",
    "PartReference": "9123",
    "Client": "Client1234",
    "CurrentState": -1,
    "Valid": 1,
    "Archived": 0
  },
  {
    "OrderId": 3,
    "Name": "Order 3",
    "CreationDate": "2023-07-05T11:05:48.000Z",
    "Description": "This is a description for the order 3",
    "PartReference": "1234",
    "Client": "Client1234",
    "CurrentState": -1,
    "Valid": 1,
    "Archived": 0
  }
]

List all orders
GET/orders

Available from : v1.13

license required : prod


OPERATION

Return an operation from the specified id.

GET /operations/3
Responses200
Headers
Content-Type: application/json
Body
[
      {
          "OperationId": 3,
          "OrderId": 2,
          "Name": "HyperOperation 2",
          "CreationDate": "2023-07-12T09:48:25.000Z",
          "Description": "Operation for the part 1234",
          "CNCId": 2,
          "DocumentId": 0,
          "CurrentState": -1,
          "PartsToMake": 460,
          "PartsMade": 12,
          "PartsPerCycle": 4,
          "CycleTime": 1200
      },
  ]

Get an operation
GET/operations/{id}

Available from : v1.13

license required : prod

An operation object will contain the following fields :

Attribute name Description
OperationId The ID of the operation
OrderId The ID of the linked order
Name The name of the operation
CreationDate The creation date of the operation
Description The description of the operation
CNCId The ID of the CNC on which the operation is configured
DocumentId The ID of the linked document
CurrentState The current state of the operation (-1: No state, 0: Start, 1: Resuming, 2: Stop, 3: Pause)
PartsToMake The quantity of parts to be made
PartsMade The quantity of parts already made
PartsPerCycle The quantity of parts during a cycle
CycleTime The reference cycle time (in seconds)

Fields are automatically updated depending on the operation’s progress.

URI Parameters
HideShow
id
number (required) Example: 3

ID of the operation


Operations

Returns all operations depending on the specified filters.

GET /operations?cnc=1&order=2
Responses200
Headers
Content-Type: application/json
Body
[
    {
        "OperationId": 2,
        "OrderId": 2,
        "Name": "HyperOperation",
        "CreationDate": "2023-07-12T09:48:25.000Z",
        "Description": "Operation for the part 1234",
        "CNCId": 1,
        "DocumentId": 0,
        "CurrentState": -1,
        "PartsToMake": 460,
        "PartsMade": 34,
        "PartsPerCycle": 8,
        "CycleTime": 3200
    },
    {
          "OperationId": 3,
          "OrderId": 2,
          "Name": "HyperOperation 2",
          "CreationDate": "2023-07-12T09:48:25.000Z",
          "Description": "Operation for the part 1234",
          "CNCId": 2,
          "DocumentId": 0,
          "CurrentState": -1,
          "PartsToMake": 460,
          "PartsMade": 12,
          "PartsPerCycle": 4,
          "CycleTime": 68000
      },

]

List all operations
GET/operations{?cnc,order}

Available from : v1.13

license required : prod

It is not possible to use the cnc and order filters at the same time. If both are specified anyway, the cnc filter will be ignored and only the order filter will apply.

URI Parameters
HideShow
cnc
number (optional) Example: 1

Using this cnc filter, the response will only contain operations configured for the specified CNC

order
number (optional) Example: 2

Using this order filter, the response will only contain operations depending on the specified order


Macros

Specific actions.

Delete documents on a range

This macro is used to remotely delete all the station documents on the machine within the defined range.
Supported protocols : FOCAS Heidenhain LSV2/Ethernet SMBClient FTPClient

POST /macros/DeleteRemoteRange/3
RequestsFOCASOther
Headers
Content-Type: application/json
Body
{
  "MinRange": 1000,
  "MaxRange": 4000,
  "TargetFolder": "folder/path",
  "Prefix": "O"
}
Responses200500
Headers
Content-Type: application/json
Body
{
  "MacroStatus": {
    "StatusCode": 0,
    "StatusMessage": "Document deleted"
  }
}
Headers
Content-Type: application/json
Body
{
  "MacroStatus": {
    "StatusCode": 3,
    "StatusMessage": "3: Impossible to delete the document on the destination folder"
  },
  "FileDeleteStatusDetail": {
    "FileName": "O1",
    "ErrorCode": 13,
    "ErrorMessage": "EW_REJECT",
    "ErrorMessageMeaning": "Error(CNC execution rejection)"
  }
}
Headers
Content-Type: application/json
Body
{
  "MinRange": 1000,
  "MaxRange": 4000,
  "TargetFolder": "folder/path",
  "Prefix": "O"
}
Responses200
Headers
Content-Type: application/json
Body
[]

Delete range
POST/macros/DeleteRemoteRange/{station}

Available from : v1.7

license required : dnc

Your request will have to contain the following fields :

Attribute name Description
MinRange Document name for the lower bounder. Only document with numerical names are accepted.
MaxRange Document name for the upper bouder. Only document with numerical names are accepted.
TargetFolder Station target folder where the documents will be deleted.(optional)(Default value is the root folder)
Prefix Program prefix used in front of program by the CNC.(optional)(Default value is an empty string) v1.8

On some CNC, it is not possible to delete the current program.
MinRange,MaxRange are required fields in your request. All other fields may be omitted.

In case of a deletion error, the macro stops and reports the error related to the last deletion attempt.

URI Parameters
HideShow
station
number (required) Example: 3

ID of the station


Generated by aglio on 03 Sep 2024