[resolved] Update plugins configuration using REST API

Important Details

How are you running Sentry?

  • [x] On-Premise docker [Version 9.0.0]

Description

I’m trying to use the REST API to setup project’s integration (slack) and alerts rules

I aim to write an ansible plugin to manage sentry projects.

Steps to Reproduce

  1. [Create a project on sentry]
  2. [Send a PUT request on /api/0/projects/<organization_slug>/<project_slug>/slack/]

Whatever payload I send, server reply with 403 error code (forbidden), even with a token which have all possible privileges selected in /settings/account/api/auth-tokens/.

According project_plugins_details.py#L121 the code exists, but I was not able to find a test in test_project_plugins.

Are you replicating a payload you scraped from Chrome? It definitely should be working.

Just tried to enable the slack directory using:

TOKEN = 'xxxx'

HEADERS = {
    'Authorization': f"Bearer {TOKEN}"
}
    r = requests.post(f"{BASE_URL}/api/0/projects/{project['organization']['slug']}/{project['slug']}/plugins/slack/",
                      headers=HEADERS)

Which is the same way than a browser enabled the plugin.

But sentry returns “You do not have permission to perform this action”

My token have full privileges selected (at least all available in the web UI)

Thanks for your help

Oh seem I have an issue with authentication, it works on another instance!

Thanks you