Actions
Defect #27787
closedCreate project failed via REST api
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
REST API
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Invalid
Affected version:
Description
Hello,
I try to use python to create a project, but it always return "HTTP Error 422: Unprocessable Entity", here are my python code, is there something wrong?
headers = {'Content-Type': 'application/json', "X-Redmine-API-Key" : "62ab473dec64ebc3d9514b0176f1f2f4a66e298c"} data = json.dumps({"is_public": false, "identifier": "test", "name": "test"}) request = urllib2.Request(url=url, headers=headers, data=data) response = urllib2.urlopen(request, timeout=5) result = json.load(response)
then I try to use curl in terminal like this:
curl -v -H "Content-Type: application/json" -H "X-Redmine-API-Key: 62ab473dec64ebc3d9514b0176f1f2f4a66e298c" -X POST --data "{\"identifier\": \"test\", \"Name\": \"test\"}" localhost:3000/redmine/projects.json
it responded, but always return name blank error, my data contained name and identifier indeed, why was not recognized?
{"errors":["Name cannot be blank","Identifier cannot be blank","Identifier is too short (minimum is 1 characters)"]}
Actions