Page 1 of 1

403 Response Error when using REST API

Posted: 25 Jul 2022, 14:52
by jcordes74
Hello all, I'm getting a 403 response error and I have no idea why. I should have access to everything on the site, as far as I know. Here is my block of code:
I replaced some sensitive variable names with (x)

import requests
import json
import getpass

url = 'http:// (x) /api/rest/issues'
#####Attempting to post data to this url

username = getpass.getuser()
password = getpass.getpass(prompt="Enter (user %s)'s password on %s: " % (username, ' (x) '))

headers = {
"Content-Type": "application/json",
"Authorization": " (x) " <--- I put my api token here
}

post_data = {
"summary": "Sample REST issue",
"description": "Description for sample REST issue.",
"additional_information": "More info about the issue",
"project": {
"name": " (x) "
},
"category": {
"name": "ASIC"
},
"handler": {
"name": " (x) "
},
"view_state": {
"name": "public"
},
"priority": {
"name": "normal"
},
"severity": {
"name": "trivial"
},
"reproducibility": {
"name": "always"
}
}


post_response = requests.post(url = url, headers = headers, json = post_data, auth = (username,password))
print(post_response) 6,1

Re: 403 Response Error when using REST API

Posted: 25 Mar 2024, 15:44
by hejizow
Hello, have you resolved your issue ?