Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Syntax for Example 3 in Feature List API

bill_schnoebelenbill_schnoebelen OS Professional, Developers, User Group Leader, csevp Posts: 109 PRO
I am trying to pass the code below from example 3 thru the API Explorer.



I get this error:

{
error: "  JSON syntax error"
}

They are asking for the following:

{
  "script": "String",
  "queries": "Object[]",
  "queries.0.key": "String",
  "queries.0.value": "String[]",
  "serializationVersion": "String",
  "sourceMicroversion": "String",
  "rejectMicroversionSkew": "Boolean"
}

I am not sure what to put in for the other values. Any ideas?

Comments

  • bill_schnoebelenbill_schnoebelen OS Professional, Developers, User Group Leader, csevp Posts: 109 PRO
    Figured it out. 

    If I copy and paste snippet directly from Example 3 webpage into API Explorer it gives error. If I copy into a formatter such as http://jsonviewer.stack.hu/ and format. Then copy paste into API Explorer. It works.

    Works
    {
      "script": "function(context is Context, queries)       {         return transientQueriesToStrings(evaluateQuery(context, qCreatedBy(makeId(\"Front\"), EntityType.FACE)));       }",
      "queries": [
        
      ]
    }


    Does not work
    {
      "script" :
        "function(context is Context, queries)
          {
            return transientQueriesToStrings(evaluateQuery(context, qCreatedBy(makeId(\"Front\"), EntityType.FACE)));
          }",
      "queries" : []
    }

Sign In or Register to comment.