Batch API Milestones

16 views
Skip to first unread message

Justin Freres

unread,
Aug 10, 2016, 7:21:47 PM8/10/16
to Assembla API Development
Does the api support batch posting?  This code only creates the first item in the Json Body array?

            AssemblaSpace spaces = new AssemblaSpace();
            spaces.id = projectMileStonesToSpace.AssemblaSpaceID;
            List<AssemblaSpaceMileStonesInput> spacemilestones = new List<AssemblaSpaceMileStonesInput>();
            //TODO: look at batching json string
            foreach (var item in milestone)
            {
                spacemilestones.Add(new AssemblaSpaceMileStonesInput()
                {
                    title = item.Description,
                    description = item.Description
                });
            }

            string assemblaBaseUrl = "https://api.assembla.com/";
            RestClient assemblaClient = new RestClient(assemblaBaseUrl)
            {

            };
            var request = new RestRequest("/v1/spaces/" + spaces.id + "/milestones.json", RestSharp.Method.POST);
            request.RequestFormat = DataFormat.Json;
            request.AddHeader("Accept", "application/json");
            request.AddHeader("X-Api-Key", creds.ApiKey);
            request.AddHeader("X-Api-Secret", creds.ApiSecret);
            foreach (var item in spacemilestones)
            {
                request.AddJsonBody(new { milestone = item });  // required to add a namespace to the serialized json object required by assembla
            }

            var response = assemblaClient.Post<AssemblaSpace>(request); 


Stanislav Kolotinskiy

unread,
Aug 11, 2016, 2:51:16 AM8/11/16
to assembla...@googlegroups.com
Hi Justin,

nope, none of the APIs supports batch creation.

Regards,
Stanislav
--
You received this message because you are subscribed to the Google Groups "Assembla API Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to assembla-api-d...@googlegroups.com.
To post to this group, send email to assembla...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Reply all
Reply to author
Forward
0 new messages