Parts

parts are the part of offset suggestion building block where the mean value and the permitted tolerances are defined for various dimensions, together with the name, description, media_url and optional field of each part.

Parts Scheme

Scheme:

{
  "id": "UUID",
  "name": "String",
  "description": "String",
  "media_url": "String",
  "optional": "JSON",
  "dimensions": [
    {
      "id": "Integer",
      "type": "String",
      "value": "Float",
      "tolerance_low": "Float",
      "tolerance_high": "Float",
      "golden_sample_value": "Float"
    }
  ],
  "golden_sample": [
    {
      "id": "Integer",
      "value": "Float"
    }
  ]
}

Example part:

{
  "id": "ae54af76-964f-4ed8-8700-793b2ed5c20b",
  "name": "part1",
  "description": "part1 description",
  "media_url": "https://offsug.hir.facts4.work/parts/part1.pdf",
  "optional": null,
  "dimensions": [
    {
      "id": 1,
      "type": "length",
      "value": 17,
      "tolerance_low": -0.2,
      "tolerance_high": 0.2,
      "golden_sample_value": 17.008
    },
    {
      "id": 2,
      "type": "diameter",
      "value": 214.8,
      "tolerance_low": -0.2,
      "tolerance_high": 0.2,
      "golden_sample_value": 214.768
    },
    {
      "id": 3,
      "type": "length",
      "value": 278,
      "tolerance_low": -0.2,
      "tolerance_high": 0.2,
      "golden_sample_value": 278.002
    }
  ],
  "golden_sample": []
}

GET methods

GET /api/v1/parts

Returns the list of parts.

Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Response JSON Object:
 
  • id (string) – the part’s unique identifier
  • name (string) – part’s name
  • description (string) – part’s description
  • media_url (string) – location of part’s media file (usually a pdf with schematics)
  • optional (json) – optional information
  • dimensions (array) – array of dimensions
  • dimensions.id (int) – the dimension numerical identifier
  • dimensions.type (string) – the dimension type, accepts only ‘length’ and ‘diameter’
  • dimensions.value (float) – the dimension nominal value
  • dimensions.tolerance_low (float) – the dimension low tolerance
  • dimensions.tolerance_high (float) – the dimension high tolerance
  • dimensions.golden_sample_value (float) – the most accurate measurment of this dimension on the golden sample
  • golden_sample (array) – array of the calibration measurement made on the golden sample
  • golden_sample.id (int) – the calibration measurement is relataed to the dimension with the same id
  • golden_sample.value (float) – the value of calibration measurement on the golden sample
Status Codes:

Example request:

GET /api/v1/parts?access_token=1f2992fb20b1ca4661f62aadf84a4d3fa90d02ce1ce1a4ae1f56e965ef902ddd HTTP/1.1
Host: https://offsug.hir.facts4.work

Example response:

HTTP/1.1 200 OK
Content-type: application/json

{
  "id": "ae54af76-964f-4ed8-8700-793b2ed5c20b",
  "name": "part1",
  "description": "part1 description",
  "media_url": "https://offsug.hir.facts4.work/parts/part1.pdf",
  "optional": null,
  "dimensions": [
    {
      "id": 1,
      "type": "length",
      "value": 17,
      "tolerance_low": -0.2,
      "tolerance_high": 0.2,
      "golden_sample_value": 17.008
    },
    {
      "id": 2,
      "type": "diameter",
      "value": 214.8,
      "tolerance_low": -0.2,
      "tolerance_high": 0.2,
      "golden_sample_value": 214.768
    },
    {
      "id": 3,
      "type": "length",
      "value": 278,
      "tolerance_low": -0.2,
      "tolerance_high": 0.2,
      "golden_sample_value": 278.002
    }
  ],
  "golden_sample": [
    { "id": 1, "value": 17.010 },
    { "id": 2, "value": 214.770 },
    { "id": 3, "value": 278.001 }
  ]
}
GET /api/v1/parts/:id

Returns the requested part.

Parameters:
  • id (string) – the id of the part
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Response JSON Object:
 
  • id (string) – the part’s unique identifier
  • name (string) – part’s name
  • description (string) – part’s description
  • media_url (string) – location of part’s media file (usually a pdf with schematics)
  • optional (json) – optional information
  • dimensions (array) – array of dimensions
  • golden_sample (array) – array of the calibration measurement made on the golden sample (may be empty)
Status Codes:

Example request:

GET /api/v1/part/ae54af76-964f-4ed8-8700-793b2ed5c20b?access_token=1f2992fb20b1ca4661f62aadf84a4d3fa90d02ce1ce1a4ae1f56e965ef902ddd HTTP/1.1
Host: https://offsug.hir.facts4.work

Example response:

HTTP/1.1 200 OK
Content-type: application/json

{
  "id": "ae54af76-964f-4ed8-8700-793b2ed5c20b",
  "name": "part2",
  "description": "part2 description",
  "media_url": "https://offsug.hir.facts4.work/parts/part2.pdf",
  "optional": null,
  "dimensions": [
    {
      "id": 1,
      "type": "length",
      "value": 176,
      "tolerance_low": -0.1,
      "tolerance_high": 0.1,
      "golden_sample_value": 176.01
    },
    {
      "id": 2,
      "type": "length",
      "value": 320.3,
      "tolerance_low": -0.4,
      "tolerance_high": 0.4,
      "golden_sample_value": 320.299
    }
  ],
  "golden_sample": []
}

POST methods

POST /api/v1/parts

Create a new part.

This call returns the newly created part with the generated id.

Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Request JSON Object:
 
  • name (string) – part’s name
  • description (string) – part’s description
  • media_url (string) – location of part’s media file (usually a pdf with schematics)
  • optional (json) – optional information
  • dimensions (array) – array of dimensions
Response JSON Object:
 
  • id (string) – the generated part unique identifier
  • name (string) – part’s name
  • description (string) – part’s description
  • media_url (string) – location of part’s media file (usually a pdf with schematics)
  • optional (json) – optional information
  • dimensions (array) – array of dimensions
Status Codes:

Example request:

POST /api/v1/parts?access_token=1f2992fb20b1ca4661f62aadf84a4d3fa90d02ce1ce1a4ae1f56e965ef902ddd HTTP/1.1
Host: https://offsug.hir.facts4.work

{
  "name": "part2",
  "description": "part2 description",
  "media_url": "https://offsug.hir.facts4.work/parts/part2.pdf",
  "optional": {},
  "dimensions": [
    {
      "id": 1,
      "type": "length",
      "value": 176,
      "tolerance_low": -0.1,
      "tolerance_high": 0.1,
      "golden_sample_value": 176.01
    },
    {
      "id": 2,
      "type": "length",
      "value": 320.3,
      "tolerance_low": -0.4,
      "tolerance_high": 0.4,
      "golden_sample_value": 320.05
    }
  ]
}

Example response:

HTTP/1.1 200 OK
Content-type: application/json

{
  "id": "ae54af76-964f-4ed8-8700-793b2ed5c20b",
  "name": "part2",
  "description": "part2 description",
  "media_url": "https://offsug.hir.facts4.work/parts/part2.pdf",
  "optional": {},
  "dimensions": [
    {
      "id": 1,
      "type": "length",
      "value": 176,
      "tolerance_low": -0.1,
      "tolerance_high": 0.1,
      "golden_sample_value": 176.01
    },
    {
      "id": 2,
      "type": "length",
      "value": 320.3,
      "tolerance_low": -0.4,
      "tolerance_high": 0.4,
      "golden_sample_value": 320.05
    }
  ],
  "golden_sample": []
}

PUT methods

PUT /api/v1/parts/:id

Update an existing part. All parameters must be passed. If you wish to delete a dimension you can omit it from the put request and it will be deleted.

This call returns the newly modified part.

Parameters:
  • id (string) – part’s unique id
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Request JSON Object:
 
  • name (string) – part’s name
  • description (string) – part’s description
  • media_url (string) – location of part’s media file (usually a pdf with schematics)
  • optional (json) – optional information
  • dimensions (array) – array of dimensions
  • golden_sample (array) – array of the calibration measurement made on the golden sample (may be empty)
Response JSON Object:
 
  • id (string) – the part’s unique identifier
  • name (string) – part’s name
  • description (string) – part’s description
  • media_url (string) – location of part’s media file (usually a pdf with schematics)
  • optional (json) – optional information
  • dimensions (array) – array of dimensions
  • golden_sample (array) – array of the calibration measurement made on the golden sample (may be empty)
Status Codes:

Example request:

PUT /api/v1/parts/ae54af76-964f-4ed8-8700-793b2ed5c20b?access_token=1f2992fb20b1ca4661f62aadf84a4d3fa90d02ce1ce1a4ae1f56e965ef902ddd HTTP/1.1
Host: https://offsug.hir.facts4.work

{
  "name": "part2",
  "description": "part2 new description",
  "media_url": "https://offsug.hir.facts4.work/parts/part2.pdf",
  "optional": {
    "comment": "deleted id 1"
  },
  "dimensions": [
    {
      "id": 2,
      "type": "length",
      "value": 320.3,
      "tolerance_low": -0.4,
      "tolerance_high": 0.4,
      "golden_sample_value": 320.299
    }
  ]
}

Example response:

HTTP/1.1 200 OK
Content-type: application/json

{
  "id": "ae54af76-964f-4ed8-8700-793b2ed5c20b",
  "name": "part2",
  "description": "part2 new description",
  "media_url": "https://offsug.hir.facts4.work/parts/part2.pdf",
  "optional": {
    "comment": "deleted dimension with id 1"
  },
  "dimensions": [
    {
      "id": 2,
      "type": "length",
      "value": 320.3,
      "tolerance_low": -0.4,
      "tolerance_high": 0.4,
      "golden_sample_value": 320.299
    }
  ],
  "golden_sample": []
}

PATCH methods

PATCH /api/v1/parts/:id

Update an existing part. Only the provided parameters will be updated. This is the suggested method for setting the golden sample calibration. If you wish to delete a dimension you can omit it from the patch request and it will be deleted.

This call returns the newly modified part.

Parameters:
  • id (string) – part unique id
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Request JSON Object:
 
  • name (string) – part’s name
  • description (string) – part’s description
  • media_url (string) – location of part’s media file (usually a pdf with schematics)
  • optional (json) – optional information
  • dimensions (array) – array of dimensions
  • golden_sample (array) – array of the calibration measurement made on the golden sample (may be empty)
Response JSON Object:
 
  • id (string) – the part’s unique identifier
  • name (string) – part’s name
  • description (string) – part’s description
  • media_url (string) – location of part’s media file (usually a pdf with schematics)
  • optional (json) – optional information
  • dimensions (array) – array of dimensions
  • golden_sample (array) – array of the calibration measurement made on the golden sample (may be empty)
Status Codes:

Example request:

PATCH /api/v1/parts/ae54af76-964f-4ed8-8700-793b2ed5c20b?access_token=1f2992fb20b1ca4661f62aadf84a4d3fa90d02ce1ce1a4ae1f56e965ef902ddd HTTP/1.1
Host: https://offsug.hir.facts4.work

{
  "golden_sample": [
    { "id": 1, "value": 176.014 },
    { "id": 2, "value": 320.301 }
  ]
}

Example response:

HTTP/1.1 200 OK
Content-type: application/json

{
  "id": "ae54af76-964f-4ed8-8700-793b2ed5c20b",
  "name": "part2",
  "description": "part2 new description",
  "media_url": "https://offsug.hir.facts4.work/parts/part2.pdf",
  "optional": {
    "comment": "deleted dimension with id 1"
  },
  "dimensions": [
    {
      "id": 1,
      "type": "length",
      "value": 176,
      "tolerance_low": -0.1,
      "tolerance_high": 0.1,
      "golden_sample_value": 176.01
    },
    {
      "id": 2,
      "type": "length",
      "value": 320.3,
      "tolerance_low": -0.4,
      "tolerance_high": 0.4,
      "golden_sample_value": 320.299
    }
  ],
  "golden_sample": [
    { "id": 1, "value": 176.014 },
    { "id": 2, "value": 320.301 }
  ]
}

DELETE methods

DELETE /api/parts/:id

Delete an existing part, responds with the confirmation or error. Can only delete one resource at a time, to remove a collection of parts call the DELETE method for each element.

Example request:

DELETE /api/parts/ae54af76-964f-4ed8-8700-793b2ed5c20b?access_token=1f2992fb20b1ca4661f62aadf84a4d3fa90d02ce1ce1a4ae1f56e965ef902ddd HTTP/1.1
Host: https://offsug.hir.facts4.work

Example response:

HTTP/1.1 200 OK
Parameters:
  • id (string) – part’s unique id
Query Parameters:
 
  • access_token (string) – valid access token for OAuth2 authentication
Status Codes: