I’m using the API for creating a new release for an organization, and I keep getting a 404.
This is a link to the docs
https://docs.sentry.io/api/releases/post-organization-releases/#create-a-new-release-for-an-organization
I’m able to create a new release for a project following these docs
https://docs.sentry.io/api/releases/post-project-releases/
This is my python code:
import requests
from utils.api_utils import HOST_URL, ORGANIZATION_SLUG, HEADERS
def create_releases(project, hash, release_tag):
req_session = requests.Session()
# This block fails with a status code 404
payload1 = {
'version': release_tag,
'ref': hash,
'url': 'https://github.com/' + ORGANIZATION_SLUG + '/widget/commit/' + hash,
'projects': [project]
}
post_args1 = {'headers': HEADERS, 'data': payload1}
request_url1 = HOST_URL + 'organizations/' + ORGANIZATION_SLUG + '/releases/'
response1 = req_session.post(request_url1, **post_args1)
# This block succeeds with a status code 201
payload2 = {
'version': hash,
'ref': release_tag,
'url': 'https://github.com/sightmachine/ma/commit/' + hash
}
post_args2 = {'headers': HEADERS, 'data': payload2}
request_url2 = HOST_URL + 'projects/' + ORGANIZATION_SLUG + '/' + project + '/releases/'
response2 = req_session.post(request_url2, **post_args2)
print 'request_url1: ' + request_url1
print 'response1.status_code: ' + str(response1.status_code)
print 'request_url2: ' + request_url2
print 'response2.status_code: ' + str(response2.status_code)
create_releases('ma-stage2', 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef', 'v1.2.3')