petrbroz / aps-sdk-node

Tools for accessing Autodesk Forge APIs from modern Node.js apps.
https://petrbroz.github.io/forge-server-utils/docs/index.html
34 stars 19 forks source link

Error with`getVersionDetails` #2

Closed AlexPiro closed 4 years ago

AlexPiro commented 4 years ago

Hi,

When I try to use the "getVersionDetails" with bim360 client, I get a 404 error. You're route is like that : const response = await this.get('data/v1/projects/${projectId}/items/${itemId}/versions/${versionId}', {}, ReadTokenScopes);

but in the Forge documentation there's not "items/itemsID" part so I think this function should be : const response = await this.get('data/v1/projects/${projectId}/versions/${versionId}', {}, ReadTokenScopes);

Can you confirm ? Or maybe I missed something ?

petrbroz commented 4 years ago

Thanks @AlexPiro! You're right, that endpoint is wrong... Due to the 3-legged auth token I don't include the BIM360 client in my tests, so this slipped through the cracks :/ I'll get that fixed.

petrbroz commented 4 years ago

Btw. the fix will be available in v8.0.10 :+1:

AlexPiro commented 4 years ago

Thank you Petr ! 👍 Also, just a precision about this function( because it's not specified in the documentation) : we must ensure the 'versionId' is URIEncoded. Example : "urn:xxxxxx?version=1" ==> "urn%3Axxxxxx%3Fversion%3D1"

petrbroz commented 4 years ago

Thanks for the heads-up. I was assuming that axios took care of uri-encoding the path but perhaps that's not the case. And even if it was, it's probably better to encode the params ourselves anyway. I'll add that.