S-T
S-T

Reputation: 489

Box API: Create folder on behalf of another user

I am able to create folder via put API call. Now I am trying to use User impersonation to create a new folder giving following headers.

headers = { "Authorization" : "<token>", "As-User" : "237490238" }

It is always giving me 403 forbidden as response.

I also tried creating folder this way via POSTMAN giving X-On-Behalf-Of and X-As-User headers. The response is 201 ( created ) but created_by is not the user (with id = '237490238') provided in headers.

Is it possible to have user impersonation in creating files/folders , creating shared links for files/folders via API?

Upvotes: 0

Views: 888

Answers (1)

John Hoerr
John Hoerr

Reputation: 8035

1: Your Authorization header is not formatted properly. The value needs to be prefixed by Bearer:

headers = { 
            "Authorization" : "Bearer <token>", 
            "As-User" : "237490238" 
          }

2: Ensure that the scope of your authorization token includes Manage an enterprise. This is required in order to use the As-User functionality.

Upvotes: 2

Related Questions