Skip to content

Instantly share code, notes, and snippets.

@shentonfreude
Created March 15, 2013 22:45
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save shentonfreude/5173720 to your computer and use it in GitHub Desktop.
Curl command to create new issue in RedMine for a specific project with some pre-created custom fields. Since the CSV importers all seem ancient, perhaps we can do this with a REST POST for each line in a CSV ourselves.
#!/bin/sh
# You have to enable the Custom Field for the tracker you're targetting: bug, feature, whatever.
# cf without 'id' doesn't set anything
# cf with 'id' and no 'name' sets that attr
#
# Upon creation we get a record back with custom fields filled in, with id:
#
# "custom_fields":[{"id":1, "name":"Operating System", "value":"FeedBSD"},
# {"id":7, "name":"Operating System Version", "value":""},
# {"id":2, "name":"Database", "value":""},
# {"id":8, "name":"Database Version", "value":""},
# {"id":3, "name":"Web Server", "value":""},
# {"id":4, "name":"App Server", "value":""},
# {"id":9, "name":"App Server Version", "value":""},
# {"id":5, "name":"Memory (GB)", "value":""},
# {"id":6, "name":"Disk Used (GB)", "value":""},
# {"id":10, "name":"Pi", "value":""}],
curl -v \
--user "username:PASSWORD" \
-H "Content-Type: application/json" \
-X POST \
-d '{"issue": {"project_id": "app-migration", "subject":"curl subject custom OS", "priority_id": 4, "custom_fields": [{"value":"FeedBSD", "id": 1}, {"value":"1.2.3", "id":7}, {"value":"Cust", "id":12, "name":"Custy"} ] } }' \
http://ec2-INSTANCE-ID-HERE.compute-1.amazonaws.com/redmine/issues.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment