HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Help with API V2

edited April 2022 in Vanilla 3.x Help

I am trying to use the V2 API to create categories and discussions on Vanilla. I have set up a local (dev) space as a sandbox. Once I have a proof of concept build I plan to move it to production which is on the hosted (paid) plan.


After going through all of the help articles I have not been able to find an article or set of articles that I can use to consume the V2 API. I am looking for the following:


  1. Authentication: Based on what I have read, I think all that is needed is for me to use a personal access token and include that in the header of each API request along with the Authorization: Bearer <token>". I tried this but keep receiving an error saying I need to authenticate into the site. I am looking for some sample code (nodeJs, PHP, or even curl) that would show how I authenticate.

Here is what I was doing:

curl -G -H "Authorization: Bearer vva.VoACpIVzcvh_ptjZ40cxxxxxxxxxxxxxxx" -H "Accept: application/json" "http://localhost/vanilla/index.php?p=/api/v2/discussions"

This is the response I keep getting:

{

  "message": "You must sign in to the private community.",

 "status": 403,

  "msg": "You must sign in to the private community.",

  "code": 403,

  "except": [],

  "type": "!private",

  "description": null

}

Tagged:
Sign In or Register to comment.