Skip to content

Instantly share code, notes, and snippets.

@comeara
Created June 11, 2012 17:17
Show Gist options
  • Save comeara/2911403 to your computer and use it in GitHub Desktop.
Save comeara/2911403 to your computer and use it in GitHub Desktop.
Bulk Load AgileZen Stories
require "rest_client"
require "pry"
project_id = "99999"
api_key = "00000000000000000000000000000000"
url = ("https://agilezen.com/api/v1/projects/%s/stories" % project_id)
logger = Logger.new($stdout)
headers = {
"X-Zen-ApiKey" => api_key,
"Accept" => "text/json"
}
CSV.foreach("stories.csv", headers: :first_row, return_headers: false) do |story|
payload = {
text: story["Story"],
color: "green",
size: story["Points"],
tags: [ "feature" ]
}.to_json
begin
response = RestClient.post(url, payload, headers)
logger.info "Created: #{story["Story"]}"
rescue => e
pry binding
logger.error "Failed: #{story["Story"]}"
end
end
source :rubygems
gem "json_pure"
gem "rest-client"
gem "pry"
Story T-Shirt Size Points Category Priority
As a developer, I can bulk load stories into AgileZen. S 1 Project Admin 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment