How to get image from snapshot urn? - autodesk-forge

BIM360 Issues - Snapshot URN Image
Is it possible to get the snapshot image via snapshot_urn? I could get snapshot_urn from BIM360 Issues API and trying to get download link from Data Management API, but I got 403 error "reason": "No namespace provided".
"snapshotUrn": "urn:adsk.objects:os.object:ng-issues-prod-0df8decb-8ab7-4985-b1cd-f79ad844e1db/1545c7b6-8c96-480e-9800-b494f69e9b65"
https://developer.api.autodesk.com/oss/v2/buckets/ng-issues-prod-0df8decb-8ab7-4985-b1cd-f79ad844e1db/objects/1545c7b6-8c96-480e-9800-b494f69e9b65/signeds3download

Related

403 Unauthorized error to derivative service Autodesk Forge (Viewer not showing)

I am currently working on a project using the Autodesk Forge platform. I have been using the Viewer, Model Derivative, and Data Management APIs without any issues since yesterday that suddenly when I tried to open a model (uploaded weeks ago) and returned a 403 error on requests to view the model.
I did some research with Postman and I tried to do the same calls I'm doing in my app with the same credentials. The OAuth API and Data Management API seem to work correctly because they let me have access to the token and upload a model. The problem seems to be when I try to translate the uploaded model.
The call I'm using in Postman is:
https://developer.api.autodesk.com/modelderivative/v2/designdata/job
And what Postman is returning is:
403 Unauthorized.
{
"developerMessage": "The client_id specified does not have access to the api product",
"moreInfo":"https://forge.autodesk.com/en/docs/oauth/v2/developers_guide/error_handling/",
"errorCode": "AUTH-001"
}
Something similar happens when I try to open a model in my app.
The Request URL is the next one: https://developer.api.autodesk.com/derivativeservice/v2/manifest/{urn}?domain=http%3A%2F%2Flocalhost%3A8080
And the returned code is 403 Unauthorized.
These are the headers in the call:
Headers
The codebase hasn't changed in weeks and exhibits the same behavior leading me to believe it's a code change in the referenced Autodesk Forge libraries or a service issue on the derivative or viewer service.
I can upload cut-up code if required.
Thank you.

Fetch Project Users from BIM360 using Forge API

I was able to retrieve Project Users of a project in BIM 360 using Forge API about a month back, using API as GET - https://developer.api.autodesk.com/bim360/admin/v1/projects/:projectId/users.
Since the last month, I am not able to fetch the users and receiving 403 responses. I have tried with the two-legged and three-legged token, as well as appending the header of the region in request, but still not getting the response.
API Link: https://forge.autodesk.com/en/docs/bim360/v1/reference/http/admin-v1-projects-projectId-users-GET/
Please assist me, if anyone is aware of any changes made in the API.
I tried this request and I got this 403 response.
{
"developerMessage": "Token does not have the privilege for this request.",
"moreInfo":"https://forge.autodesk.com/en/docs/oauth/v2/developers_guide/error_handling/",
"errorCode": "AUTH-010"
}
As we can read, I was missing account:read in the scope. Can you check that or give us the developerMessage you receive ?

Failed to fetch forge manifest - autodesk forge viewer

I was working with a forge viewer for past few weeks.It was fine and I've developed 2 extensions for it and now the application has been shaped well.It's been a while I've looked at the viewer and all of a sudden I'm unable to work with the viewer.The same code working before was not working now.
I can see some changes in documentation stuffs of autodesk forge viewer.Is there any breaking changes.I've been following previous documentation of model-derivative api for preparing file for the viewer.
If I try to run the viewer,I'm getting this error.
Failed fetching Forge manifest
I'll attach a screenshot of the networks tab result,
https://i.stack.imgur.com/lG7VA.png
Similarly when I try to run fetch using postman with this end point,
https://developer.api.autodesk.com/modelderivative/v2/designdata/:urn/manifest
I'm getting,
{
"developerMessage": "Token scope not set. This request does not have the required privilege.",
"moreInfo": "https://forge.autodesk.com/en/docs/oauth/v2/developers_guide/error_handling/",
"errorCode": "AUTH-010"
}
But this was working before.For this endpoint, setting scope is optional as per the documentation.I've tried the same before, it worked.
I'll leave the documentation for your reference
https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-manifest-GET/
What am I doing wrong?Anything essential I've missed or any breaking changes.I was confused because I'm getting the same response even with a basic viewer code(simplifying all my extra extension logics).
Per our documentation it is the user context that is optional and not oauth scopes - the following scopes have always been required to access the manifest:
Required OAuth Scopes
data:readorviewables:read
If you could access this endpoint with no scopes specified then it was an oversight on our part and must have been fixed now ...

Create Signed URL for Object in BIM360 OSS

I'm trying to set up an Signed URL for an Design Automation Workflow which is triggered by an Webhook inside of the BIM360 OSS. If a file is added the webhooks triggers an endpoint to start a Design Automation. The webhook is working. And the Design Automation is working too. The Problem occurs if i try to wire both up. I#m trying to create a Signed URL of the File like suggested in this post from Petr Broz link stackoverflow.
To use this API it is requierd to use an Token which is obatined by 2-Legged-Auth which is working with all necessary Scopes. In the response of the Webhook is an ID for the Folder and Version. The API is recognizing the ID.
The problem occurs in the response of this endpoint to create the signed url: https://developer.api.autodesk.com/oss/v2/buckets/:bucketKey/objects/:objectKey/signed
I'm using the wip.dm.emea as bucket because the file is stored in the EU BIM360 OSS.
The response is a 403 Forbidden:
{
"reason": "Only the bucket creator is allowed to access this api."
}
Is it even possible to get the File ID like in this example Forge how to Download File ?
Because this Solution requires a 3-Legged-Auth Flow which is not possible for a complete Automation.
The thing which makes me question is, that you can achieve this Workflow in plane Forge. But not in BIM360 where i have no control over the Buckets that are created by the System!?
I think this is an architectural missmatch between the Forge API and the BIM360 implementation!? Will there be a solution for this in the future?
Best regards
Jan
Unfortunately, I can confirm that it's not possible to create a signed URL for your BIM360 storage currently, as the error message mentioned, the endpoint requires the bucket owner to do this operation, this is what it is now. But I agree with you that this should be an architecture mismatch between Forge OSS and BIM360 implementation, and it's already been requested in our system, please keep "CPOSS-1066" to check with us about the progress.
As for the current way, you can keep the 3 legged token and using that for the output Url and also in the onComplete() callback, I have the blog post https://forge.autodesk.com/blog/upload-your-design-automation-output-file-bim360-docs which details the way to work, hope it helps at this moment.

Daily Limit Error Message with Google Drive

I am getting an error message when trying to use the Google Drive API to get a file. Using Python, the line that causes error is:
file = service.files().get(fileId=googleDriveFileId).execute()
The error message is:
HttpError: <HttpError 404 when requesting
https://www.googleapis.com/drive/v2/files/0B6Cpn8NXwgGPSE8zQW10XzJMc0k?alt=json returned
"File not found: 0B6Cpn8NXwgGPSE8zQW10XzJMc0k">
Basically saying "File not found"
However, if I put the URL being requested into browser, I get a different error message:
https://www.googleapis.com/drive/v2/files/0B6Cpn8NXwgGPSE8zQW10XzJMc0k
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "dailyLimitExceededUnreg",
"message": "Daily Limit Exceeded. Please sign up",
"extendedHelp": "https://code.google.com/apis/console"
}
],
"code": 403,
"message": "Daily Limit Exceeded. Please sign up"
}
}
Neither of these error messages seem correct to me. I know the file is there. Here is a working link to the same file retrieved from "Share Link" in the Google Drive UI:
https://docs.google.com/file/d/0B6Cpn8NXwgGPSE8zQW10XzJMc0k
I have also checked the Quota reports in the api console, and we are at 0% usage.
Any ideas what is going on here?
Thanks
I had similar errors following the python quickstart.
It turned out I had correctly created an API key etc, however had missed step 2:
Select the Services tab in your API project, and enable the Drive API.
Having used the API before I skipped along and missed this crucial point.
Both of the error messages did not have accurate info. The problem was related to permissions. I was using Google Picker to upload the files in question, but these files were not automatically available to the API because of permissions. I thought they would be according to documentation.
I solved problem by setting the permissions for the folder the images are being uploaded to for "Public" using the Google Drive UI. Now my app has permission to access the uploaded files.
While setting files permission to "Public" is okay in my case, as these files are meant to be public, I know this would not be acceptable in all cases. Can someone please shed light on how to handle this problem.... so that files uploaded with Google Picker automatically have the permission to be accessed by the API without setting folder permissions to "Public"?
The messages were accurate.
In the first case, because you don't have permission, Google gives a file not found. This is a standard security measure, rather than leak information by confirming the file exists.
In the second case, you called the API without an Authentication Header, so Google treats you as an unregistered and unauthorised app, which for some Google APIs is OK, up to a a daily quota. In the case of Drive, that daily quota is zero.
I agree it's not intuitive, and I'm sure many developer man years have been wasted (mine included), but it is accurate.
To answer your question about why the uploaded file is inaccessible, check that you have requested the correct scope, and that you are using the correct client id and mime type when doing the upload.