CreateDSZ creates stitch data in the DSZ format (extension .dsz) from text, from an existing design, or from both. Send it as an HTTP POST with a JSON body to StitchJob (see Overview) with "RequestType": "CreateDSZ", "ServerVersion": 3 and a valid WebApiLicense (see ZSK Web API License). Key names are case-sensitive, and integer fields need JSON integers ("DistanceMM": 2, not 2.5).
Input
- Text only: send
MonogramsandNeedle, omitEmbroideryBase64. - Existing design only: send
EmbroideryTypeandEmbroideryBase64, omitMonograms(or send an empty list). NoNeedlelist is needed. - Design + text: send
EmbroideryType,EmbroideryBase64,MonogramsandNeedle(with a TC or TBF design,"UseEmbroideryColors": 1can replaceNeedle, see Colors).TextAlignmentwith aModeplaces the text relative to the design (see TextAlignment to Design).
Text rules: without a design, every monogram needs a non-blank text; up to 9 monograms, one line each, 200 characters in total; FontSizeMM 5 to 50; FontFamily as listed by GetFontList (case-sensitive); UsedNeedle starts at 1. See Monograms.
EmbroideryType is required with every design and must be one of these values (case-sensitive):
| EmbroideryType | File | Processing |
|---|---|---|
TC | .z00 | Used directly. |
TBF | .tbf | Used directly. |
DST | .dst | Used directly, without conversion to TC. |
DSZ | .dsz | Used as is, without conversion, with or without text. |
Text, if present, is added to the design. CreateDSZ needs no needle assignment (SeqAssignmentJson), not even for DST or DSZ input.
Colors
Needlesets the colors by position (first entry = needle 1); each monogram uses the entry in itsUsedNeedle, so with textNeedleneeds at least that many entries.Red,Green,Blue: integers 0 to 255; other fields: strings.- Only
Red,Green,BlueandColorNameare passed on to the stitch generation; only CreateTC writes the other fields into its output. - With a TC or TBF design,
"UseEmbroideryColors": 1buildsNeedlefrom the design, replacing a sent list;UsedNeedlethen selects an entry by position. See UseEmbroideryColors.
Response
On success: HTTP 200 with a JobResponseType with Success true and:
RequestData: the created DSZ file, Base64-encoded.Info:widthMm,heightMm,maxX,maxY,minX,minYandnumberOfStitchesof the created DSZ file;maxX/maxY/minX/minYare distances in mm from the start point (widthMm=maxX+minX,heightMm=maxY+minY). The other fields (alsonumberOfCuts, TC output only) are 0 ornull.NeedleColor: with a design, empty. Text only: one entry per monogram (itsUsedNeedleand thatNeedleentry).NeedleSequence: with a design, empty. Text only: theUsedNeedleof each monogram.Time: processing times.PreviewDatastays empty, also withWithPreview; use CreatePNG for a preview.
Info, NeedleColor, NeedleSequence and Time are JSON strings: parse each non-empty string a second time. Example for a design + text (formatted and shortened):
{
"Info": "{ \"widthMm\": ..., \"heightMm\": ..., ..., \"numberOfStitches\": ..., ... }",
"NeedleColor": "",
"NeedleSequence": "",
"PreviewData": "",
"RequestData": "base64 encoded DSZ data",
"Success": true,
"Time": "{ ... }"
}On error, Success is false and RequestData holds the error message.
Errors
| HTTP | RequestData | Cause |
|---|---|---|
| 200 | Error: unknown command! | RequestType is not exactly CreateDSZ. |
| 400 | No licence token found. / Invalid licence token. | WebApiLicense is missing, empty or rejected. |
| 400 | Only one line of text per monogram ... / A maximum of 9 lines ... / The text length is longer ... | More than one Text entry, more than 9 monograms, or more than 200 characters. |
| 400 | Invalid needle color list | Text without a Needle list, or too few Needle entries for the highest UsedNeedle. |
| 400 | Invalid monogram text. Found empty text | No design, and Monograms is missing or empty or a monogram text is blank. |
| 400 | Invalid font size. ... / Invalid font name(s). ... / The text contains not supported character(s): ... | FontSizeMM outside 5 to 50, FontFamily not listed by GetFontList, or characters the font does not support. |
| 500 | Error message | Unexpected error, for example invalid Base64 in EmbroideryBase64. |
| 503 | Error message | The stitch data could not be created; retry later. |