Community
BIM 360 API Forum
Welcome to Autodesk’s BIM 360 API Forums. Share your knowledge, ask questions, and explore popular BIM 360 API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discrepancy in methods to post relationships

0 REPLIES 0
Reply
Message 1 of 1
JvBMov
140 Views, 0 Replies

Discrepancy in methods to post relationships

With the endpoint https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-versions-POST/ one can assign versions and add relationships to items with the body

 

    data: dict = {
        "jsonapi": {"version": "1.0"},
        "data": {
            "type": "versions",
            "attributes": {
                "name": fileLocationAsPath.name,
                "extension": {"type": autodeskVersionType, "version": "1.0"},
            },
            "relationships": {
                "item": {"data": {"type": "items", "id": itemId}},
                "storage": {"data": {"type": "objects", "id": objectId}},
                "refs": {"data": childReferences},
            },
        },
    }

 

Where childReferences is a list made with (a) childReference object(s):

{
                "type": "versions",
                "id": childVersionId,
                "meta": {
                    "refType": "xrefs",
                    "direction": "from",
                    "extension": {
                        "type": "xrefs:autodesk.core:Xref",
                        "version": "1.1",
                        "data": {"nestedType": "overlay"},
                    },
                },
            }

 

This works fine, for both first and all subsequent versions. However, due to the limit of 200 child items (see this forum post) I'd like to use the https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-versions-version_id-re... endpoint to do so. However, using the body (for a test with two child versions)

{'type': 'versions',
 'id': childVersionId,
 'meta': {'refType': 'xrefs',
  'direction': 'from',
  'extension': {'type': 'xrefs:autodesk.core:Xref',
   'version': '1.1',
   'data': {'nestedType': 'overlay'}}}}

I get the response:

{'jsonapi': {'version': '1.0'},
 'errors': [{'id': '7433722e-029e-48a8-b6b2-a97baa715718',
   'status': '400',
   'code': 'FUNCTION_NOT_SUPPORTED',
   'detail': 'BIM360 currently does not support the creation of refs.'}]}

And with the body

{'jsonapi': {'version': '1.0'},
 'data': [{'type': 'versions',
   'id': childVersionId0,
   'meta': {'refType': 'xrefs',
    'direction': 'from',
    'extension': {'type': 'xrefs:autodesk.core:Xref',
     'version': '1.1',
     'data': {'nestedType': 'overlay'}}}},
  {'type': 'versions',
   'id': childVersionId1,
   'meta': {'refType': 'xrefs',
    'direction': 'from',
    'extension': {'type': 'xrefs:autodesk.core:Xref',
     'version': '1.1',
     'data': {'nestedType': 'overlay'}}}}]}

The following is returned:

{'jsonapi': {'version': '1.0'},
 'errors': [{'id': 'd3679c47-4341-401e-9a69-9d0fef2e3bf1',
   'status': '400',
   'code': 'BAD_INPUT',
   'title': 'One or more input values in the request were bad',
   'detail': '"data" at line 1, pos 41 is empty or contains more than one child.'}]}

 

So the question is, how can one add 200+ child references to an item? The endpoints above seem both unsuitable.

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report