I'm trying to build an application by using the autodesk-forge
-api's. To start with I created an App inside my Autodesk configuration to receive an "ClientID" and a "Client Secret" which are required to make API calls.
Somehow, when I try to use the createBucket
-API call, which is documentet here I get an answer bad request 400
and I dont't know why.
here is my API call:
let oAuth2TwoLegged = new ForgeSDK.AuthClientTwoLegged(clientId,
clientSecret, [
'data:read',
'data:write',
'bucket:create',
'bucket:read',
'data:write',
'data:read',
'viewables:read'
], autoRefresh);
oAuth2TwoLegged.authenticate().then(function(credentials){
var HubsApi = new ForgeSDK.HubsApi(); //Hubs Client
var BucketsApi = new ForgeSDK.BucketsApi(); //Buckets Client
BucketsApi.createBucket({bucketKey :"Test", policyKey: "transient"},{}, oAuth2TwoLegged, credentials).then((response) => {
console.log(' new BUCKET: ', response)
}).catch((err) => {
console.log('ERROR BLA: ', err)
});
}).catch((err) => {
console.log('oauth error: ', err)
})
Does anyone have a suggestion what I might doing wrong?
when I use a different call, for example this:
BucketsApi.getBuckets({}, oAuth2TwoLegged, credentials).then(function(response){
console.log('buckets: ', response.body);
}, function(err){
console.error(err);
});
it works...
EDIT
If I do the following:
BucketsApi.createBucket(xyda_select_rtl, {'bucketKey' :'xyda_select_rtl',
'policyKey': 'transient'}, oAuth2TwoLegged, credentials).then((response) => {
console.log(' new BUCKET: ', response)
}).catch((err) => {
console.log('ERROR BLA: ', err)
});
I get xyda_select_rtl
is not defined!?!
When I add:
var xyda_select_rtl;
I get the error Missing the required parameter 'postBuckets' when calling createBucket
Ehhm.... yeah :-/