[Pregunta] api call with attached filters

Etiquetas:
  • Filter
  • BIMplus
  • API

Is it possible to call an endpoint of the api with certain filters? For Example if I only want all the issues with status = "open" (as I would expect by filtering whit Odata)

Method: GET
URL: https://api-stage.bimplus.net/v2/bimplus/projects/0d2ce2cc-3588-45d6-a59a-f6b89ebed34e/issues?$filter=status eq 'Open'

Is there a way to do that?

Yes, it is possible, but not directly via a query, but via a general generic object filter. The reason is, it makes no sence to create a hardcoded queries for something that can be variable. And the status of the issue is basically any string, since Bimplus supports the BCF standard and it is possible to define any value there in addition to defining any custom attribute.
This means, even if the status of the issue has the recommended values in BCF standart, the third party can define other statuses that are transferred during the BCF import.

Here is a small example of creating and using a filter.
Let's try - following Three steps :

1. Create custom filter ====================
POST 'https://api-stage.bimplus.net/v2/<teamslug>/settings/filter?project_id=<projectid>' \
Request body :
{
"disciplineID":"5f18a295-ab3c-4c0f-a4d3-59206f9ff98f",
"name":"Custom Filter",
"filterString":"[I][9f89aa9a-67ce-41c9-ae18-44c871137276].Value[F][0]=b8c98f47-cd7d-4f9f-9a9c-c985d55d6e98",
"disableSortByModels":true
}

Response :
{
"id":"6db944fb-bb9d-4f70-b253-0d354ecfabc7",
"disciplineID":"5f18a295-ab3c-4c0f-a4d3-59206f9ff98f",
"name":"Custom Filter",
"filterString":"[I][9f89aa9a-67ce-41c9-ae18-44c871137276].Value[F][0]=b8c98f47-cd7d-4f9f-9a9c-c985d55d6e98",
"isDefault":false,
"disableSortByModels":false
}

2. Use filter to get Open Issues ====================

GET 'https://api-stage.bimplus.net/v2/<teamslug>/projects/<projectid>/filters/6db944fb-bb9d-4f70-b253-0d354ecfabc7?_=1667487100796'
response :
{
"structureDepth":2,
"structure":{
"id":"87a1956d-72a3-470d-b939-2d3523dd5861",
"parent":null,
"name":"Custom Filter",
"type":"Structure",
"children":[{
"id":"b20fffad-f102-459b-954c-898ba55411de",
"parent":"87a1956d-72a3-470d-b939-2d3523dd5861",
"name":"State (Open)",
"type":"Structure",
"children":[{
"id":"4632f725-0cb2-4acc-8802-55468543bfc5",
"parent":"b20fffad-f102-459b-954c-898ba55411de",
"name":"Issue name",
"type":"Issue",
"children":null,
"count":0,
"level":2,
"nodeInfo":"(=b8c98f47-cd7d-4f9f-9a9c-c985d55d6e98);4632f725-0cb2-4acc-8802-55468543bfc5"
},
...
],
"count":3,
"level":1,
"nodeInfo":"(=b8c98f47-cd7d-4f9f-9a9c-c985d55d6e98)",
"attributeId":"9f89aa9a-67ce-41c9-ae18-44c871137276",
"attributeValues":{
"values":["b8c98f47-cd7d-4f9f-9a9c-c985d55d6e98"
],
"operators":["="
]
}
}
],
"count":3,
"level":0,
"nodeInfo":""
}
}

DO NOT FORGET TO DELETE THE FILTER WHEN YOU NO LONGER NEED IT

3. Delete created filter ====================

DELETE 'https://api-stage.bimplus.net/v2/<teamslug>/settings/filter/6db944fb-bb9d-4f70-b253-0d354ecfabc7'

For more information about filters, see the documentation
https://doc.allplan.com/pages/viewpage.action?pageId=18040753#id-4.28ObjectNavigator/ObjectFilterService-createObjectFilter