Draft

TIP

The stage of a draft is the stage of the measurement profile used to generate it. By default it is production.

Create draft

API Request

POST https://api.bespokify.com/v2/drafts

Request parameters

Parameter Type Required Description
patternId integer yes The pattern ID
patternRef string no The pattern reference ID or name. Default is ID of latest main reference (master)
callbackUrl string no The URL that our server will send the response data to. See: Callback URL
measurementType string yes Possible values: body, final
enableOptionFallbacks boolean no true means predefined fallback values will be used for missing options. Default value: true.
measurements object yes The set of predicted measurements. See: Prediction
seams object no The seam allowances
options object no The options value
bodyShapes object no The body shapes value
measurementProfileId string no The measurement profile ID
measurementProfileRevId string no The measurement profile revision ID
selectedMeasurementIds array no The measurement IDs to be picked from measurements
note string no The note to be attached to this draft
metadata object no The additional information of this draft
parentDraftId string no The ID of parent draft to match
targetGarmentMeasurements object no The target values for output garment measurements
materials object no The materials used in this draft. For material config, see nesting config and scaling config.

Option fallbacks

Option fallbacks are safe/neutral values that are predefined for the options of a pattern. When creating a draft with the enableOptionFallbacks flag set to true (default), they will be applied to the input where possible to avoid errors caused by missing option values.

If one or more fallback values are used, there will be a field called appliedOptionFallbacks in the response body that lists all the options where the fallbacks have been applied. For example:

{
  "id": "e02bc2c6-ff09-4f71-9b31-062f5ef7e751",
  "jobUrl": "https://api.bespokify.com/v2/jobs/12908488-3926-493d-a2b4-81e9b11df378",
  "appliedOptionFallbacks": {
    "fit": "slim"
  }
}

Example request

{
  "patternId": 397,
  "patternRef": "master",
  "callbackUrl": "https://foo.bar/draft-callback",
  "measurements": {
    "mbHeight": 185,
    "mbWeight": 75,
    "mbMidNeck": 36,
    "mbSleeveShoulderWidth": 46
  },
  "measurementType": "body",
  "seams": {
    "armhole": 0.5,
    "attachment": 1,
    "collar": 0.6
  },
  "options": {
    "bodyLengthAdj": 1,
    "collar": "regular",
    "pocket": "leftBreast"
  },
  "bodyShapes": {
    "posture": "regular",
    "shoulderSlope": "regular"
  },
  "measurementProfileId": "22228488-1234-493d-a2b4-81e9b11df378",
  "measurementProfileRevId": "33338488-4444-5555-a2b4-81e9b11df378",
  "selectedMeasurementIds": ["mbWeight", "mbHeight"],
  "note": "Example draft",
  "metadata": {
    "customer": "John Doe",
    "cutDate": "02/07/18"
  },
  "materials": {
    "primary": {
      "id": "e6131e69-2a68-46a5-a9db-97a0e10b3ae2",
      "name": "Paper",
      "factoryId": null,
      "nesting": {
        "partMargin": 1,
        "sheetWidth": 140,
        "partRotation": "0",
        "preNestRotation": null
      },
      "scaling": {
        "easeAdjWarp": 1,
        "easeAdjWeft": 1,
        "shrinkageWarp": 1,
        "shrinkageWeft": 1
      }
    }
  },
  "targetGarmentMeasurements": {
    "chestGirth": 109,
    "waistGirth": 100,
    "shoulderWidth": 48,
    "bodyLength": 75,
    "sleeveLengthLeft": 63,
    "sleeveLengthRight": 66
  }
}

Example response

{
  "id": "e02bc2c6-ff09-4f71-9b31-062f5ef7e751",
  "jobUrl": "https://api.bespokify.com/v2/jobs/12908488-3926-493d-a2b4-81e9b11df378"
}

You can monitor the status of this job using the jobUrl.

List all drafts

Get the list of all drafts that belong to the current user's group.

API Request

GET https://api.bespokify.com/v2/drafts

Request parameters

Parameter Type Required Description
search string no The text to search drafts' IDs and notes by
sort string no The order to sort drafts in. Possible values: asc, desc. Default: desc
status string no The generation status to filter drafts by. Possible values: inProgress, failed, completed
patternId int no The pattern ID to filter drafts by
patternRefId string no The pattern reference ID to filter drafts by
measurementProfileId string no The measurement profile ID to filter drafts by
measurementProfileRevId string no The measurement profile revision ID to filter drafts by
stage string no The stage to filter drafts by. Possible values: testing, production, all. Default: production

Example response

[
  {
    "id": "1893a3f2-e38e-453a-966a-e520d2ea137f",
    "patternId": 397,
    "patternRefId": "4b5366e031cce514a471e148000e5605571208b7",
    "measurementProfileId": "0f2116b1-706e-49ce-8b3a-35d51d3ba544",
    "measurementProfileRevId": "",
    "status": "completed",
    "createdAt": "2019-02-15T07:18:47.102Z",
    "createdBy": "ea90477c-af10-42b3-bf66-be304c49521a",
    "note": "Sample"
  },
  {
    "id": "38531432-4df8-4030-bc43-f4c093e5c8aa",
    "patternId": 397,
    "patternRefId": "40176ec6397c4d065564393fd8d7915790a07834",
    "measurementProfileId": "0f2116b1-706e-49ce-8b3a-35d51d3ba544",
    "measurementProfileRevId": "",
    "status": "completed",
    "createdAt": "2019-02-14T08:03:18.597Z",
    "createdBy": "ea90477c-af10-42b3-bf66-be304c49521a",
    "note": "Example draft"
  }
]

Get single draft

Get a draft by its ID.

API Request

GET https://api.bespokify.com/v2/drafts/{id}

Request parameters

Parameter Type Required Description
id string yes The ID of the draft to retrieve.

Example response

{
  "id": "e02bc2c6-ff09-4f71-9b31-062f5ef7e751",
  "patternId": 397,
  "measurements": {
    "mbHeight": 185,
    "mbWeight": 75
  },
  "measurementType": "body",
  "metadata": {
    "customer": "John Doe",
    "cutDate": "02/07/18"
  },
  "seams": {
    "armhole": 0.5,
    "attachment": 1,
    "collar": 0.6
  },
  "options": {
    "bodyLengthAdj": 1,
    "collar": "regular",
    "pocket": "leftBreast"
  },
  "bodyShapes": {
    "posture": "regular",
    "shoulderSlope": "regular"
  },
  "status": "completed",
  "garmentMeasurements": {
    "sleeveLengthRight": 63,
    "sleeveLengthLeft": 63,
    "bodyLength": 76
  },
  "targetGarmentMeasurements": {
    "chestGirth": 109,
    "waistGirth": 100,
    "shoulderWidth": 48,
    "bodyLength": 75,
    "sleeveLengthLeft": 63,
    "sleeveLengthRight": 66
  },
  "materials": {
    "primary": {
      "id": "e6131e69-2a68-46a5-a9db-97a0e10b3ae2",
      "name": "Paper",
      "factoryId": null,
      "nesting": {
        "partMargin": 1,
        "sheetWidth": 140,
        "partRotation": "0",
        "preNestRotation": null
      },
      "scaling": {
        "easeAdjWarp": 1,
        "easeAdjWeft": 1,
        "shrinkageWarp": 1,
        "shrinkageWeft": 1
      }
    }
  },
  "stage": "production",
  "objects": ["Pocket", "ShirtBack", "ShirtFront", "Sleeve"],
  "note": "Example draft",
  "createdAt": "2018-08-24T09:41:21.393Z",
  "createdBy": "6e01fe4e-e15a-4f5f-8b98-7d07b61ac68f"
}

Update note

API Request

PATCH https://api.bespokify.com/v2/drafts/{id}

Request parameters

Parameter Type Required Description
note string yes The new note text.

Example request

{
  "note": "Update note"
}

Example response

{
  "id": "e02bc2c6-ff09-4f71-9b31-062f5ef7e751",
  "patternId": 397,
  "measurements": {
    "mbHeight": 185,
    "mbWeight": 75
  },
  "measurementType": "body",
  "metadata": {
    "customer": "John Doe",
    "cutDate": "02/07/18"
  },
  "seams": {
    "armhole": 0.5,
    "attachment": 1,
    "collar": 0.6
  },
  "options": {
    "bodyLengthAdj": 1,
    "collar": "regular",
    "pocket": "leftBreast"
  },
  "bodyShapes": {
    "posture": "regular",
    "shoulderSlope": "regular"
  },
  "status": "completed",
  "garmentMeasurements": {
    "sleeveLengthRight": 63,
    "sleeveLengthLeft": 63,
    "bodyLength": 76
  },
  "targetGarmentMeasurements": {
    "chestGirth": 109,
    "waistGirth": 100,
    "shoulderWidth": 48,
    "bodyLength": 75,
    "sleeveLengthLeft": 63,
    "sleeveLengthRight": 66
  },
  "material": {
    "primary": {
      "id": "e6131e69-2a68-46a5-a9db-97a0e10b3ae2",
      "name": "Paper",
      "factoryId": null,
      "nesting": {
        "partMargin": 1,
        "sheetWidth": 140,
        "partRotation": "0",
        "preNestRotation": null
      },
      "scaling": {
        "easeAdjWarp": 1,
        "easeAdjWeft": 1,
        "shrinkageWarp": 1,
        "shrinkageWeft": 1
      }
    }
  },
  "stage": "production",
  "objects": ["Pocket", "ShirtBack", "ShirtFront", "Sleeve"],
  "note": "Update note",
  "createdAt": "2018-08-24T09:41:21.393Z",
  "createdBy": "6e01fe4e-e15a-4f5f-8b98-7d07b61ac68f"
}

Get draft files

API Request

GET https://api.bespokify.com/v2/drafts/{id}/assets/{filename}

Request parameters

Parameter Type Required Description
id string yes The draft ID
filename string yes The name of the file to download. Possible values: input.yml, garmentMeasurements.json

Response parameters

Parameter Type Description
filename string The file name
size number The file size in bytes
encoding string The encoding type
content string The file content
contentSha256 string The SHA-256 hash of content

Example response

{
  "fileName": "input.yml",
  "size": 1476,
  "encoding": "base64",
  "content": "IyA9PSBTY2hlbWEgSW5mb3",
  "contentSha256": "4c294617b60715c1d218e61164a3abd4808a4284cbc30e6728a01ad9aada4481"
}

Get tech pack file

API Request

POST https://api.bespokify.com/v2/drafts/{id}/generateTechPack

Or

GET https://api.bespokify.com/v2/drafts/{id}/techPack

WARNING

The https://api.bespokify.com/v2/drafts/{id}/techPack endpoint is deprecated and will be removed soon.

Request parameters

Parameter Type Description
excludedSections array The sections will be hidden in the tech pack file. Possible values: options, seams, materials, garmentMeasurements

Example response

{
  "id": "732c7b60-49fe-41ec-87e0-6561f1e9a67b",
  "jobUrl": "https://api.bespokify.com/v2/jobs/5e7857fc-d84c-4fbf-95be-fadc96a11cff"
}

Visit the jobUrl to get the URL for the tech pack file.

Delete testing draft

Delete a draft belong to testing stage by its ID.

API Request

DELETE https://api.bespokify.com/v2/drafts/{id}

Request parameters

Parameter Type Required Description
id string yes The draft ID

Response status codes

Code Meaning
204 No Content The draft profile was deleted successfully
404 Not Found A draft with the provided ID could not be found