Diagram

Answered

Shape Primitives are not returned on export

Hello, I am migrating from the CDK 3.0 REST API to the new iink SDK REST API. I am attempting to obtain the primitive items of the converted diagram (lines ellipse, arc, etc) like in the documentation here https://developer.myscript.com/docs/interactive-ink/1.3/web/rest/diagram-example/ but I am only ever receiving stroke items back from Myscript. 

here is a request body example of a circle I am sending to myscript

   

{
	"configuration": {
		"lang": "en_GB",
		"export": {
			"jiix": {
				"primitives": true,
				"bounding-box": false,
				"strokes": true
			}
		}
	},
	"contentType": "Diagram",
	"strokeGroups": [
		{
			"strokes": [
				{
					"x": [
						881.45,
						881.45,
						877.09,
						868.36,
						864,
						859.63,
						855.27,
						850.9,
						855.27,
						864,
						877.09,
						894.54,
						912,
						929.45,
						964.36,
						990.54,
						1016.72,
						1051.63,
						1073.45,
						1090.9,
						1090.9,
						1095.27,
						1104,
						1112.72,
						1117.09,
						1117.09,
						1121.45,
						1121.45,
						1117.09,
						1104,
						1099.63,
						1095.27,
						1086.54,
						1077.81,
						1064.72,
						1051.63,
						1038.54,
						1016.72,
						999.27,
						981.81,
						968.72,
						955.63,
						938.18,
						912,
						890.18,
						885.81,
						881.45,
						877.09,
						872.72
					],
					"y": [
						117.27,
						121.63,
						130.36,
						152.18,
						182.72,
						208.9,
						239.45,
						265.63,
						283.09,
						300.54,
						313.63,
						322.36,
						331.09,
						335.45,
						344.18,
						344.18,
						344.18,
						344.18,
						335.45,
						331.09,
						326.72,
						322.36,
						313.63,
						304.9,
						287.45,
						270,
						248.18,
						230.72,
						213.27,
						200.18,
						182.72,
						174,
						165.27,
						160.9,
						152.18,
						147.81,
						143.45,
						139.09,
						134.72,
						126,
						126,
						121.63,
						112.9,
						108.54,
						104.18,
						99.81,
						99.81,
						99.81,
						99.81
					]
				}
			]
		}
	]
}

  How do I configure the request to get the shape primitives?


Thank you,

Jacob


Best Answer

Dear Jacob,


Thank you for contacting us.


If you want to get the converted items, you should set the "conversionState"parameter to "DIGITAL_EDIT", in your request body. So your REST request body would look like:


{

  "configuration": {

    "lang": "en_GB",

    "export": {

      "jiix": {

        "primitives": true,

        "bounding-box": false,

        "strokes": true

      }

    }

  },

  "contentType": "Diagram",

  "conversionState":"DIGITAL_EDIT", 

  "strokeGroups": [

    { ...



You should also choose your export format by setting the 'Accept' Header value to the format you want.
For instance if you want svg, you would set 'image/svg+xml,application/json', or for JIIX format you would set 'application/vnd.myscript.jiix,application/json'.


Best regards,


Gwenaëlle

1 Comment

Answer

Dear Jacob,


Thank you for contacting us.


If you want to get the converted items, you should set the "conversionState"parameter to "DIGITAL_EDIT", in your request body. So your REST request body would look like:


{

  "configuration": {

    "lang": "en_GB",

    "export": {

      "jiix": {

        "primitives": true,

        "bounding-box": false,

        "strokes": true

      }

    }

  },

  "contentType": "Diagram",

  "conversionState":"DIGITAL_EDIT", 

  "strokeGroups": [

    { ...



You should also choose your export format by setting the 'Accept' Header value to the format you want.
For instance if you want svg, you would set 'image/svg+xml,application/json', or for JIIX format you would set 'application/vnd.myscript.jiix,application/json'.


Best regards,


Gwenaëlle


1 person likes this
Login or Signup to post a comment