Ôokami
Ôokami

Reputation: 21

REST api post in redmine with a python script

I am trying to post issues in redmine using the rest API, I am using a python script to do so:

here is my script:

import requests
import json

username = "x"
password = "x"

url = "http://localhost:3000/issues.json"
data = open('rest.json', 'rb')

r = requests.post(url, auth=(username, password), data=data)

print(r.status_code) 
print(r.text)

and here is the JSON I am trying to post

{
    "issue" : {
        "id" : 2,
        "projet_id" : 1,
        "tracker_id" : 1,
        "priority_id" :1,
        "status_id" : 1,
        "author_id" : 1,
        "subject" : "Subject changed",
        "description": "The subject was changed",
        "category_id" :1,
        "assigned_to_id" : 1        
    }
}  

the problem is that each time I am having an error 422 telling me that "issues cant be empty, tracker cant be empty and status as well"

can you guys help me with that?

thank you

Upvotes: 0

Views: 937

Answers (0)

Related Questions