Closed habdirad closed 11 months ago
Hello, could you please specify how are you consuming iModels API - via the @itwin/imodels-client-management
NPM package or calling it directly?
If you are using the mentioned API package, version 3.0.0 of that package targets iModels API V2 and should form a correct request. Please let me know if that is not the case.
If you are calling the iModels API directly, please note that we strongly recommend to always explicitly specify the API version that you intend to target using accept
header. This is how you target iModels API V2 - documentation. If you explicitly target iModels API V2 you should be able to use ?iTwinId={someId}
url query parameter. If you do not specify the API version explicitly the request goes to the default version (which is V1) and there it complains about missing projectId
parameter. Please add the suggested accept: application/vnd.bentley.itwin-platform.v2+json
header and let me know if the issue persists.
Hi @habdirad -- as you have noticed, the iTwins API (https://developer.bentley.com/apis/itwins/operations/get-my-itwins/) only returns the iTwins for which you are a member of (https://developer.bentley.com/apis/access-control/operations/get-itwin-members/).
If I understand correctly, since you personally are an Account Administrator, you would expect the get-my-itwins API to return all iTwins. I'd like to better understand that requirement. How are you utilizing this API call? Is it for some type of reporting? Have you built an interface on top of this API to visualize all iTwins in your Account? If you can, I'd like to learn more so I have a better context as to why you expect this API to work as you said.
Hello, could you please specify how are you consuming iModels API - via the
@itwin/imodels-client-management
NPM package or calling it directly?If you are using the mentioned API package, version 3.0.0 of that package targets iModels API V2 and should form a correct request. Please let me know if that is not the case.
If you are calling the iModels API directly, please note that we strongly recommend to always explicitly specify the API version that you intend to target using
accept
header. This is how you target iModels API V2 - documentation. If you explicitly target iModels API V2 you should be able to use?iTwinId={someId}
url query parameter. If you do not specify the API version explicitly the request goes to the default version (which is V1) and there it complains about missingprojectId
parameter. Please add the suggestedaccept: application/vnd.bentley.itwin-platform.v2+json
header and let me know if the issue persists.
Thank you for the directions that helped fixing the issue with iModels. I added the header as suggested ("Accept" : "application/vnd.bentley.itwin-platform.v2+json") and passed my project Ids into the iTwinId parameter.
Hi @habdirad -- as you have noticed, the iTwins API (https://developer.bentley.com/apis/itwins/operations/get-my-itwins/) only returns the iTwins for which you are a member of (https://developer.bentley.com/apis/access-control/operations/get-itwin-members/).
If I understand correctly, since you personally are an Account Administrator, you would expect the get-my-itwins API to return all iTwins. I'd like to better understand that requirement. How are you utilizing this API call? Is it for some type of reporting? Have you built an interface on top of this API to visualize all iTwins in your Account? If you can, I'd like to learn more so I have a better context as to why you expect this API to work as you said.
Thank you for your reply. Yes, this is for reporting purposes. As an account admin, I want to ensure our projects are setup correctly (e.g., they have the right naming convention, report job numbers, and have iModels set up as expected).
I may be using a scheduled flow (e.g., workato, powerautomate, or a basic webapp) to extract data. So there is no user interface. Jsons are stored in a container to be consumed by reports (e.g., PowerBI).
So ideally, I should not need to invite myself to all projects in order to get data of all iTwins in our account.
Hi @davidhjones, please take a look at the previous comment and let me know if it makes sense to have an account level view of projects (without being invited to all projects). Thank you.
Hi @habdirad, sorry for the delayed response. You can choose to query all of your Organization's iTwins (if you are an organization admin) by adding this header:
X-iTwin-Query-Scope
=OrganizationAdmin
FWIW, by default, this header (if missing) is set to X-iTwin-Query-Scope
=MemberOfiTwin
, where only the iTwins you are a member of are within the query scope.
@habdirad can this issue be closed or are you still running into some issues?
@habdirad Please reach out if the issue is not fixed.
The issues are fixed. Thank you all for the guidance.
Describe the bug Get My iTwins endpoint does not return all (Synchro) projects on our account (only returns a small fraction of them) - I have account admin permissions: https://developer.bentley.com/apis/itwins/operations/get-my-itwins/
We have been using https://developer.bentley.com/apis/projects/operations/my-projects, which worked properly and returned several hundred projects (we use similar $top parameter so the request limit is not at issue) but this endpoint is being deprecated and has caused another issue as described below.
Also, we cannot get iModels from many projects anymore with our app: https://developer.bentley.com/apis/imodels-v2/operations/get-itwin-imodels/
when we use iTwinId as a url parameter, we get the following error:
when we use projectId as a url parameter, we get the following error:
The tryout webapp on documentation works fine, but our webapp with all scopes enabled returns the errors above.
To Reproduce Call the endpoints with our app and our account.
https://api.bentley.com/itwins/?subClass=Project
https://api.bentley.com/imodels/?iTwinId=XXXXXXXX
Expected behavior Return all Synchro projects as iTwins. Return iModels when requested using projectId or iTwinId.