0

This may sound very stupid question , but I can't find any documentation that gives me this info :

I want to make calls to v2 api from javascript.What are the endpoints for it,I only get the cUrl in docs.I have the auth_token and api_key and want to upload a file to root folder.Post request to following url gives error:

https://www.box.com/api/2.0/files/content/0?api_key=<my_api_key>&auth_token=<my_auth_token>

response :

{
    "type": "error",
    "status": 401,
    "code": "invalid_authorization_header",
    "help_url": "http:\/\/developers.box.com\/docs\/#errors",
    "message": "\"Authorization\" header either missing or invalid",
    "request_id": "1208099125507c7b0670911"
}

also,is the JSONP supported by v2 api.I have to make a cross domain reuest

vishesh
  • 2,007
  • 6
  • 32
  • 67

1 Answers1

1

The api-key and auth-token need to be send in the header. V2 APIs won't accept them in the GET parameters.

We don't currently support JSONP, but we are considering it as a post-GA add-on.

Can you please elaborate in how this doesn't work with javascript? There are some javascript examples on other StackOverflow answers that may also help.

Community
  • 1
  • 1
Peter
  • 2,551
  • 1
  • 14
  • 20
  • I hate when apis don't allow the javascript to use them – vishesh Oct 16 '12 at 05:10
  • @vishesh If you're making an authorized request from a javascript client your auth information will be visible to the user if they monitor network traffic. Do you have a good solution for avoiding that? – Ben Zittlau Oct 17 '12 at 17:56