I don't know about any Rails-specific implementations but from the general
RESTful point of view, you'd have two options: 1) Pass a set of objects
with the normal POST request. 2) Use "multipart/form-data" semantics. In
your case, option (1) would probably require a separate API endpoint (for
example, "repository/files/bulk") because you already have "POST
repository/files" defined for operation on a single entity (and having the
API figure out whether it's batch request or not based on the shape of the
payload is not a good idea in my opinion). Also, with (1) you'd probably
also need to have "PUT" and "DELETE" implemented, otherwise it can be
confusing that I can't delete/update files in batch whereas I can create
them (you can argue the same is true for (2) but in that case you wouldn't
end up with an extra API endpoint which is purely for creating new items,
at least in the beginning).

Is this something you guys would consider?

Thanks.

Pavel.
On Mar 2, 2015 4:30 PM, "Sytse Sijbrandij" <[email protected]> wrote:

> No problem, How do other Rails apps handle this (link to their api docs)?
>
> Best regards,
> Sytse Sijbrandij
> CEO GitLab B.V.
>
>
> On Tue, Feb 24, 2015 at 6:42 AM, Pavel Volgarev <[email protected]> wrote:
> > Hey Sytse,
> >
> > Sorry for the late reply (didn't see your update and no notifications
> went
> > out). I think it would make sense to make the "POST
> > /projects/:id/repository/files" respect "multipart/form-data" as content
> > type:
> >
> > Request example:
> >
> > POST /projects/123/repository/files
> > Content-Type: multipart/form-data;
> > boundary=---------------------------478322346
> >
> >
> > ---------------------------478322346
> > Content-Type: application/json
> >
> >
> > {
> >   "file_name": "app/project.rb",
> >   "branch_name": "master"
> > }
> > ---------------------------478322346
> > Content-Type: application/json
> >
> >
> > {
> >   "file_name": "app/bootstrap.sh",
> >   "branch_name": "master"
> > }
> >
> > Successful response:
> >
> > 201 Created
> > Content-Type: application/json
> >
> >
> > [
> >  {
> >  "file_name": "project.rb",
> >  "file_path": "app/project.rb",
> >  "size": 1476,
> >  "encoding": "base64",
> >  ...
> >  },
> >
> >
> >  ...
> > ]
> >
> > Let me know what you think.
> >
> > On Monday, February 2, 2015 at 4:41:51 PM UTC-5, sytse wrote:
> >>
> >> Do you have a proposal how to change the API? How do other Rails apps
> >> handle this (link to their api docs)?
> >> ᐧ
> >>
> >> Best regards,
> >> Sytse Sijbrandij
> >> CEO GitLab B.V.
> >>
> >>
> >> On Thu, Jan 29, 2015 at 10:55 AM, Pavel Volgarev <[email protected]>
> wrote:
> >> > Hi guys,
> >> >
> >> > We need to be able to commit multiple files to a project at once.
> >> > Currently, the way API works is it only allows you to commit one file
> at a
> >> > time. We were thinking about branching, committing into that branch
> and
> >> > making a Merge Request but that still doesn't change the fact that we
> end up
> >> > with multiple commits to the target branch.
> >> >
> >> > Any thoughts?
> >> >
> >> > Best regards,
> >> >
> >> > Pavel.
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > Groups "GitLab" group.
> >> > To unsubscribe from this group and stop receiving emails from it, send
> >> > an email to [email protected].
> >> > To view this discussion on the web visit
> >> >
> https://groups.google.com/d/msgid/gitlabhq/93673086-c10b-4ee1-9a0b-5be48739a5e7%40googlegroups.com
> .
> >> > For more options, visit https://groups.google.com/d/optout.
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "GitLab" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [email protected].
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/gitlabhq/da13bb17-f8cb-4530-8ad9-3d548d0fba31%40googlegroups.com
> .
> >
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "GitLab" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/gitlabhq/Q5PQdJLN4Oo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/gitlabhq/CAJTzhG9neyqo2t2kEu155sH9g2y%3DvxjRuZfCUmSwoxNPVPUPFQ%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"GitLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/gitlabhq/CABXn0AmP1_nH0RZu1372%2BHgB44_6jc_UYznK%3DuACKUEPKqwg2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to