Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
Error using booleanBodies with API
Chris_Tilton
Member Posts: 10 ✭
in General
Hi All, I am trying to use the API to create a boolean, right now I am using a simple model of three spheres and I am trying to combine them. Below is my API call, using the booleanBodies function (the namespace I am using is my own copy of the standard library), and the API explorer keeps returning an error. I have included my API call and the corresponding error below.
<pre><code><pre><code>{"feature": {"type": 134, "typeName": "BTMFeature", "message": {"featureType": "booleanBodies", "name": "SnowmanBooleanUnion", "namespace": "d2af92bf969176a0558f5f9c7::vfa91e58a301e3c528465aa9e::ef2a8e8694c7f33ac3780bbe7::mf5049db7fc147c343877597", "parameters": [{"type": 145, "typeName": "BTMParameterEnum", "namespace": "d2af92bf969176a0558f5f9c7::vfa91e58a301e3c528465aa9e::ef2a8e8694c7f33ac3780bbe7::mf5049db7fc147c343877597", "message": {"value": "UNION", "enumName": "BooleanOperationType", "parameterId": "operationType"}}, {"type": 148, "typeName": "BTMParameterQueryList", "message": {"queries": [{"type": 138, "typeName": "BTMIndividualQuery", "queryString": "query=qCompressed(1.0,\"%B5$QueryM5S12$disambiguationDataA1M2S12$disambiguationTypeS13$ORIGINAL_DEPENDENCYS9$originalsA2C0M5Sa$entityTypeBa$EntityTypeS4$EDGESb$historyTypeS8$CREATIONSb$operationIdB2$IdA1S11.6.6$FlLA0lyFq1sAHQg_0sketchwireOpS9$queryTypeSd$SKETCH_ENTITYSe$sketchEntityIdS5$line1C0M5R4R5R6R7R8RaRbRcRdS4$arc1R4C6S4$BODYR6R7R8CbA1S-c.7.9$revolveopRevolveRbSa$SWEPT_BODY\",id);"}, {"type": 138, "typeName": "BTMIndividualQuery", "queryString": "query=qCompressed(1.0,\"%B5$QueryM5S12$disambiguationDataA1M2S12$disambiguationTypeS13$ORIGINAL_DEPENDENCYS9$originalsA2C0M5Sa$entityTypeBa$EntityTypeS4$EDGESb$historyTypeS8$CREATIONSb$operationIdB2$IdA1S11.6.6$F2lgu5fXwtM3s6e_1sketchwireOpS9$queryTypeSd$SKETCH_ENTITYSe$sketchEntityIdS5$line1C0M5R4R5R6R7R8RaRbRcRdS4$arc1R4C6S4$BODYR6R7R8CbA1S-c.7.9$revolveopRevolveRbSa$SWEPT_BODY\",id);"}, {"type": 138, "typeName": "BTMIndividualQuery", "queryString": "query=qCompressed(1.0,\"%B5$QueryM5S12$disambiguationDataA1M2S12$disambiguationTypeS13$ORIGINAL_DEPENDENCYS9$originalsA2C0M5Sa$entityTypeBa$EntityTypeS4$EDGESb$historyTypeS8$CREATIONSb$operationIdB2$IdA1S11.6.6$FPFH3QRyfzxSr9o_2sketchwireOpS9$queryTypeSd$SKETCH_ENTITYSe$sketchEntityIdS5$line1C0M5R4R5R6R7R8RaRbRcRdS4$arc1R4C6S4$BODYR6R7R8CbA1S-c.7.9$revolveopRevolveRbSa$SWEPT_BODY\",id);"}], "parameterId": "tools"}}]}}}
API CALL BODY
ERROR FROM RESPONSE
<pre class="CodeBlock"><code>{
"moreInfoUrl": "",
"message": "Feature has invalid type",
"code": 9999,
"status": 400
}
0
Comments
You may want to check the "type" value, it should be "BTMFeature-134" , I see you are passing 134. We have some examples here https://onshape-public.github.io/docs/api-adv/featureaccess/#create-a-cube-feature
Hope that helps,
Paul
Thank you for the help, although the syntax I’m using here works perfectly for a cube or sphere feature in my experience, even with passing the type and typeName separately. I’ll check out the examples though and see if I can find anything.
All of the imports in your copy are still pointing towards the actual Onshape standard code, its going to be a real mess for namespaces.
Does the API call work with all of the namespaces removed (ie pointing at the actual standard code).
Another thing that seems different is that you are missing some parameters in the POST /features endpoint:
If you look at the request in glassworks, vs what you've posted.
Custom FeatureScript and Onshape Integrated Applications
The API call doesn’t seem to work when I use it without a namespace, no idea why but it doesn’t seem to know where to look for features like fSphere etc when I don’t have a namespace. I’ll definitely try including some of the other required fields, thanks so much for your help!