Solved

Standard Import API error :Count: 2, message: error.expected.jsstring

  • 6 February 2024
  • 4 replies
  • 41 views

Badge +1

Hi!

 

I’m getting a “badRequest” response from the documents API indicating 

 

"details": {

        "error": "Count: 2, message: error.expected.jsstring",

        "import_error_code": "invalid_file"

    }

 

My payload is a single page document with 61 shapes and 82 lines. I have looked at string fields (in my case: title, shapes.type, shapes.style.type, shapes.text, lines.stroke.style, linetype, lines.text.text).

I was expecting to perhaps spot an unescaped character, or something, but can’t see anything wrong.

 

Any idea what could be wrong? Am I hitting some sort of size limit?

The JSON is dynamically created as part of a software I’m building, and works in every other scenario except for this specific one.

Thank you for your help!

Paul

 

 

icon

Best answer by chasefreeman 6 February 2024, 21:38

View original

Comments

Userlevel 1
Badge

Hi Paul! Happy to be of help here.

 

We do have size limitations on the import, but a payload that small shouldn’t be anywhere near the maximum limit. You will see a specific error for exceeding that limitation if you ever encounter it. 

 

That error indicates that a field in the payload that is expected to be a string is not. Common causes of that could be unescaped characters or the wrong type being used in place of a string. It’s difficult to identify what exactly the cause is without seeing the payload itself and due to limitations on our end we can’t easily differentiate where in the file this is occurring. I would do another look over to make sure there isn’t any unescaped special characters or something like a number where a string should be. The error is occurring twice, so there is a good chance it is the same culprit for both errors. It may be worth looking for where there are two instances of the same ID for example.


Just to make sure we're on the same page, here are our resources for creating a document from JSON with our Import Document endpoint:

Thanks for taking an interest in this API and let me know if you have any more questions.

Badge +1

I found my answer, there were two null values in shapeId’s for some lines. Apologies!

Badge +1

Thanks a lot for your help!

Userlevel 1
Badge

No worries and no problem! Glad you were able to find the issue!

Reply