API works flawlesslesly except for when creating a folder

新規投稿

コメント

5件のコメント

  • Rui Barbosa

    Hi Luis,

    Please share with us how to replicate your experience.

    Is this an OAuth client side or server side (JWT) app?

    Can the user making the call actually see the parent folder where you are trying to create the folder?

    Let us know.

    0
    コメントアクション パーマリンク
  • Louis Fico

    OAuth 2.0 (bearer token) Server Side.

    Yes the user making the call can see the parent folder.

    Sample curl request:

     

    $curl = curl_init();

    curl_setopt_array($curl, array(
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS =>'{
    "name": "New Folder",
    "parent": {
    "id": "parentfolderidhere"
    },
    "folder_upload_email": {
    "access": "open"
    },
    "sync_state": "synced"
    }',
    CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Bearer bearerTokenHere
    ),
    ));

    $response = curl_exec($curl);

    curl_close($curl);
    echo $response;

    Thanks

    0
    コメントアクション パーマリンク
  • Louis Fico

    Hello,

    Is there any follow-up to this?

    Thanks!

    0
    コメントアクション パーマリンク
  • Rui Barbosa

    Hi Louis,

    Is this PHP?

    I am unable to replicate your case, an have no php experience, so other than a missing quote next to TokenHere I can't help.

    Please take a look at this curl example:

    curl -i -X POST "https://api.box.com/2.0/folders" \
    -H "Authorization: Bearer <ACCESS_TOKEN>" \
    -H "Content-Type: application/json" \
    -d '{
    "name": "New Folder",
    "parent": {
    "id": "0"
    }
    }'

    it works fine.

    In order to eliminate user permissions, please try to create the folder on the user root folder: 0

    It could be related to application permissions though, please check those.

     

    0
    コメントアクション パーマリンク
  • Louis Fico

    Of course that curl request isn't going to work. That's why I created the ticket. Do you have any logs on your end?

    Thanks,

     

    Louis

    0
    コメントアクション パーマリンク

投稿コメントは受け付けていません。