Re: Updating a "patch" state via REST

2018-10-10 Thread Markus Mayer
On Wed, 10 Oct 2018 at 00:33, Stewart Smith  wrote:
>
> Markus Mayer  writes:
> > I am working on a script that will, amongst other things, update the
> > state ("Accepted", "Rejected", etc.) of patches in our own Patchwork
> > installation. The script is using the REST API. All requests in the
> > script, so far, are GET requests. They work fine.
> >
> > Now, I want to issue a PUT request to update the patch state, also
> > using the REST API. However, no matter what I try, the request gets
> > rejected by the server.
>
> I think you want the PATCH request rather than PUT?
>
> https://github.com/stewart-ibm/pwnm-sync is my script I use to update
> patch status (from notmuch mail tags) and that seems to be the request
> type that works for me (with patchwork.ozlabs.org)

Indeed. That works. Thanks a lot!

Regards,
-Markus
___
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork


Re: Updating a "patch" state via REST

2018-10-10 Thread Stephen Finucane
On Wed, 2018-10-10 at 18:33 +1100, Stewart Smith wrote:
> Markus Mayer  writes:
> > I am working on a script that will, amongst other things, update the
> > state ("Accepted", "Rejected", etc.) of patches in our own Patchwork
> > installation. The script is using the REST API. All requests in the
> > script, so far, are GET requests. They work fine.
> > 
> > Now, I want to issue a PUT request to update the patch state, also
> > using the REST API. However, no matter what I try, the request gets
> > rejected by the server.
> 
> I think you want the PATCH request rather than PUT?
> 
> https://github.com/stewart-ibm/pwnm-sync is my script I use to update
> patch status (from notmuch mail tags) and that seems to be the request
> type that works for me (with patchwork.ozlabs.org)

Yeah, you want PATCH. PUT requires an entirely new object (like POST)
which is used to overwrite the existing object. PATCH just needs the
updated fields. The examples used in 'git-pw' does just this [1][2][3]
(though I realize the function is confusing called 'put' - will
update).

Stephen

PS: As an aside, there's a rather good article [4] on all things
POST/PUT...which we (well, Django REST Framework) do the exact opposite
of :) Worth a read though

[1] https://github.com/getpatchwork/git-pw/blob/1.4.0/git_pw/patch.py#L175
[2] https://github.com/getpatchwork/git-pw/blob/1.4.0/git_pw/api.py#L273
[3] https://github.com/getpatchwork/git-pw/blob/1.4.0/git_pw/api.py#L156-L170
[4] https://williamdurand.fr/2014/02/14/please-do-not-patch-like-an-idiot/

___
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork


Re: [PATCH 0/4] Add dbbackup, dbrestore commands

2018-10-10 Thread Stephen Finucane
On Wed, 2018-10-10 at 09:16 +0100, Stephen Finucane wrote:
> On Wed, 2018-10-10 at 15:35 +1100, Daniel Axtens wrote:
> > Series looks good to me. I haven't taken a deep enough look to
> > feel comfortable Reviewed-by-ing it, but it looks sufficiently simple
> > and straight-forward that I wouldn't object to it being merged.
> > 
> > Regards,
> > Daniel
> 
> Fair. I've gone ahead and applied this as it's helpful while working on
> the Submission de-normalization work. Thanks!
> 
> Stephen

I have dropped the first patch in the series though as it no longer
applies, given the other doc patch.

Stephen

___
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork


Re: [PATCH 0/4] Add dbbackup, dbrestore commands

2018-10-10 Thread Stephen Finucane
On Wed, 2018-10-10 at 15:35 +1100, Daniel Axtens wrote:
> Series looks good to me. I haven't taken a deep enough look to
> feel comfortable Reviewed-by-ing it, but it looks sufficiently simple
> and straight-forward that I wouldn't object to it being merged.
> 
> Regards,
> Daniel

Fair. I've gone ahead and applied this as it's helpful while working on
the Submission de-normalization work. Thanks!

Stephen

___
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork


Re: Updating a "patch" state via REST

2018-10-10 Thread Stewart Smith
Markus Mayer  writes:
> I am working on a script that will, amongst other things, update the
> state ("Accepted", "Rejected", etc.) of patches in our own Patchwork
> installation. The script is using the REST API. All requests in the
> script, so far, are GET requests. They work fine.
>
> Now, I want to issue a PUT request to update the patch state, also
> using the REST API. However, no matter what I try, the request gets
> rejected by the server.

I think you want the PATCH request rather than PUT?

https://github.com/stewart-ibm/pwnm-sync is my script I use to update
patch status (from notmuch mail tags) and that seems to be the request
type that works for me (with patchwork.ozlabs.org)

-- 
Stewart Smith
OPAL Architect, IBM.

___
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork