2

Around half the API methods found in the documentation are broken when attempting to test the API call via the web interface.

Here's an API that does work:

/me

Note that under the access_token field, Get Token will automatically populate the field with the users token. If you don't populate the field, you get an expected error:

{
  "error_id": 401,
  "error_message": "This method requires an access_token",
  "error_name": "access_token_required"
}

Here's one that doesn't work:

/answers/{id}/accept

Here, access_token does not have a button to automatically populate the access_token field. Whether or not you fill in the fields manually, clicking the button throws an error in javascript, with no error displayed to the user. Here's what's found in the console of my browser:

/mini-profiler-resources/results Failed to load resource: the server responded with a status of 404 (Not Found)  

console.js?v=0d76f585b0e1:1 Uncaught TypeError: Cannot read property 'find' of undefined  
    at e (console.js?v=0d76f585b0e1:1)  
    at Object.T [as run] (console.js?v=0d76f585b0e1:1)  
    at HTMLButtonElement.onclick (accept-answer:200)

A second one that doesn't work either:

/questions/render

Here, access_token is an optional input, but it does not display on the page at all. Clicking run yields the same error above.

0

1 Answer 1

3

This is fixed.

There are two parts to this.

1. The button was straight-up broken for POST requests. It was ignoring the value from the key field and instead calling a function without the right parameters. This is fixed and you should not be able to run to your heart's content.

2. Getting a valid access token for calling this method is a fairly lengthy process, because you also need a application with write access. (The key normally used by the documentation does not have write access.)

You must:

  1. Register an app with stack apps.
  2. Create a post on stack apps describing your app, and reference it in your app's configuration. (Granting write access)
  3. Use OAuth to obtain an access token for your account with your app.

Once you complete those steps, you can use your app's key and your access token in the tool.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .