Rally Software

 View Only
  • 1.  [Agile Central] Creating an iteration through REST API not working

    Posted Nov 09, 2018 02:53 AM

    I tried to create an iteration through REST API with the following command. (username and password are masked)

    $ curl -XPOST -H "Content-Type: application/json" -u 'username:password' 'https://rally1.rallydev.com/slm/webservice/v2.0/iteration/create' -d '{"endDate": "2018-11-16T00:00:00+09:00","startDate":"2018-11-12T00:00:00+09:00","name":"Iteration#42" ,"project":"166266038080","state":"Planning","sync":"true"}'

    But I got the following error. It says the JSON data is not valid but I think it's valid. Do you have any idea why?

    { "CreateResult": { "_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "Errors": [ "Cannot parse input stream due to I/O error as JSON document: Parse error: expected '}' but saw ',' [ chars read = >>>{\"endDate\":\"2018-11-16T00:00:00+09:00\",<<< ]" ], "Warnings": [] } }



  • 2.  Re: [Agile Central] Creating an iteration through REST API not working
    Best Answer

    Posted Nov 09, 2018 04:41 AM

    Hitoshi,

     

    You need to include the Artifact type in your request.  I modified your string:

     

    curl -XPOST -H "Content-Type: application/json" -u 'username:password' 'https://rally1.rallydev.com/slm/webservice/v2.0/iteration/create' -d '{"Iteration":{"endDate": "2018-11-16T00:00:00+09:00","startDate":"2018-11-12T00:00:00+09:00","name":"Iteration#42" ,"project":"166266038080","state":"Planning","sync":"true"}}'

     

    Also, when using a Username and Password instead of an APIKey it will be necessary to use a Security Token.  You will need to maintain a session with curl using cookies.  Here is an example of doing this:

     

    rally - the same WSAPI v2.0 security key works in a REST client, but produces invalid key error when used with curl - St… 

     

    Here is some further information about using curl and the API Key, if you would like to use that method.

     

    WS API request examples using curl and browser RES - CA Knowledge 

     

    I hope this helps.

     

    Michael



  • 3.  Re: [Agile Central] Creating an iteration through REST API not working

    Posted Nov 09, 2018 06:31 AM

    H Michael, 

    thank you so much. it worked!

    I have one more question. Can you add an iteration to all the children projects like I can do in a web browser using bulk operation?



  • 4.  Re: [Agile Central] Creating an iteration through REST API not working

    Posted Nov 09, 2018 07:53 AM

    Hitoshi,

     

    I am glad that did the trick for you!

     

    I don't think it is possible to do a create for all the child projects, but morky01 will, hopefully, know for sure.

     

    Michael



  • 5.  Re: [Agile Central] Creating an iteration through REST API not working

    Posted Nov 11, 2018 07:11 PM

    Ok. thanks for your help!