Re: NEW PREFERENCE - return=query-result

Matthew Kerwin <matthew@kerwin.net.au> Fri, 11 September 2015 21:40 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=lists.ie@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 6D9671B31D2 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 11 Sep 2015 14:40:38 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.289
X-Spam-Level:
X-Spam-Status: No, score=-6.289 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Af-TtCp-Dr9p for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 11 Sep 2015 14:40:35 -0700 (PDT)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E6C041ACD9F for <httpbisa-archive-bis2Juki@lists.ietf.org>; Fri, 11 Sep 2015 14:40:34 -0700 (PDT)
Received: from lists by frink.w3.org with local (Exim 4.80) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1ZaW0l-0006Im-W8 for ietf-http-wg-dist@listhub.w3.org; Fri, 11 Sep 2015 21:37:36 +0000
Resent-Date: Fri, 11 Sep 2015 21:37:35 +0000
Resent-Message-Id: <E1ZaW0l-0006Im-W8@frink.w3.org>
Received: from maggie.w3.org ([128.30.52.39]) by frink.w3.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <phluid61@gmail.com>) id 1ZaW0g-0006I1-2p for ietf-http-wg@listhub.w3.org; Fri, 11 Sep 2015 21:37:30 +0000
Received: from mail-qg0-f47.google.com ([209.85.192.47]) by maggie.w3.org with esmtps (TLS1.2:RSA_ARCFOUR_SHA1:128) (Exim 4.80) (envelope-from <phluid61@gmail.com>) id 1ZaW0d-0008CL-8g for ietf-http-wg@w3.org; Fri, 11 Sep 2015 21:37:29 +0000
Received: by qgx61 with SMTP id 61so74101133qgx.3 for <ietf-http-wg@w3.org>; Fri, 11 Sep 2015 14:37:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=Ql/jGHS0jpHdqKc0W0UqAXY8MxreVkUVbwZtwtVLdI4=; b=jljCLusCiiVAIIAFKqdFLheI5UAH+BxXo020/g9YWnCbYR6EPSZOCNtWaw9okESRyW wp0LNdbDTr0YolKlYUDynWxjBakbLTVyby9gh1xRwFIaVmC511S530r4WUfnIsKRgNAi 6Zq0fnHsQi2Te6KFtqRFeBevDww+jeY8w9c9qZYe/A60pZwOC49/yK//QD88REDKSIxo PrE3aFfjX1EW8wDJ4kj5PgGqW4Vu1WHGUuZcNvuZ6zucXqtTpB4FxGFjPdzaRNWuWnVW X+vzybUlu7oD9nNV6r8M3X3qAKyXLBwYHVInYI0KIxA92Z/PpfVG9TFA6SivfTOnHU4F Aodg==
MIME-Version: 1.0
X-Received: by 10.140.132.133 with SMTP id 127mr1750222qhe.6.1442007421400; Fri, 11 Sep 2015 14:37:01 -0700 (PDT)
Sender: phluid61@gmail.com
Received: by 10.55.45.67 with HTTP; Fri, 11 Sep 2015 14:37:01 -0700 (PDT)
Received: by 10.55.45.67 with HTTP; Fri, 11 Sep 2015 14:37:01 -0700 (PDT)
In-Reply-To: <383F7C4D-A006-420B-9504-FD343996ED95@oracle.com>
References: <55F1FAB3.2050808@oracle.com> <44321676-D9B4-484C-A490-F5FFCE071D26@oracle.com> <CABP7RbcMTDEM6VOT7ydBTvbH0B6eTYWqVbeV6qcj-KSh7ertLw@mail.gmail.com> <383F7C4D-A006-420B-9504-FD343996ED95@oracle.com>
Date: Sat, 12 Sep 2015 07:37:01 +1000
X-Google-Sender-Auth: F1Pl4q0idUPWmYXkSCQ9RJLC908
Message-ID: <CACweHNAk-_EfScpgRigTL4pE5BhTrpN=5m1_DZpdR=NSAJy94A@mail.gmail.com>
From: Matthew Kerwin <matthew@kerwin.net.au>
To: Phil Hunt <phil.hunt@oracle.com>
Cc: James M Snell <jasnell@gmail.com>, ietf-http-wg@w3.org, Ning Dong <ning.dong@oracle.com>
Content-Type: multipart/alternative; boundary="001a11c081cc1ddbe2051f7f84b2"
Received-SPF: pass client-ip=209.85.192.47; envelope-from=phluid61@gmail.com; helo=mail-qg0-f47.google.com
X-W3C-Hub-Spam-Status: No, score=-5.1
X-W3C-Hub-Spam-Report: AWL=-0.780, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, W3C_AA=-1, W3C_WL=-1
X-W3C-Scan-Sig: maggie.w3.org 1ZaW0d-0008CL-8g 3f1d23d72add546640cdf9cfd028a6af
X-Original-To: ietf-http-wg@w3.org
Subject: Re: NEW PREFERENCE - return=query-result
Archived-At: <http://www.w3.org/mid/CACweHNAk-_EfScpgRigTL4pE5BhTrpN=5m1_DZpdR=NSAJy94A@mail.gmail.com>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/30200
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

If a resource can be coded to have two behaviours (and branch on the
'prefer' header), why not just code two resources?

It seems much cleaner to me to have one URI that always stores a query and
returns 201, and another that always executes immediately and returns 200,
when POSTed to.

They're both valid uses of POST.
On 12/09/2015 6:08 AM, "Phil Hunt" <phil.hunt@oracle.com> wrote:

> Agree. If we had search then I would say post should create a resource by
> default.
>
> But without search I think many are stuck with using post to search given
> concerns about passing PII and other restricted info on url with GET.
>
> Phil
>
> > On Sep 11, 2015, at 10:10, James M Snell <jasnell@gmail.com> wrote:
> >
> > To be honest, I'm entirely  -1 on a preference for query-result. If
> > you want something like this, use PUT or POST to create the stored
> > query, then create a new resource that you can either use GET or
> > SEARCH (http://tools.ietf.org/html/draft-snell-search-method-00) on.
> > In my opinion, `query-result` would entirely be an abuse of the
> > preference mechanism.
> >
> >> On Fri, Sep 11, 2015 at 8:56 AM, Phil Hunt <phil.hunt@oracle.com>
> wrote:
> >> This is difficult. Two conventions are in collision.  The definition of
> post to create a resource and the expectation that a query returns a result.
> >>
> >> I would maybe tip the scales in favor of what most Oracle apis would
> need as a default.
> >>
> >> Would it be true that clients want to create stored searches by default?
> >>
> >> Phil
> >>
> >>> On Sep 10, 2015, at 14:49, Ning Dong <ning.dong@oracle.com> wrote:
> >>>
> >>> Hi,
> >>>   Could you please review the request of adding a new value for return
> prefer header?
> >>>
> >>>   The new value is "query-result", which is used when creating a query
> definition resource with POST or PUT request.
> >>>   The client would like the server to create the query definition
> resource, but also execute the query and return the query result.
> >>>   For example,
> >>>   POST /employees/searches HTTP/1.1
> >>>   Host: example.org
> >>>   Content-Type: application/json
> >>>   Prefer: return=query-result
> >>>
> >>>   {
> >>>       "q": "name eq foo",
> >>>       "fields": ["name","age","startdate"],
> >>>       "orderBy": ["name","age:desc"]
> >>>   }
> >>>
> >>>   This above resource defines a query (equivalent to select name, age,
> startdate from employees where employees.name='foo' order by name, age
> desc).
> >>>   Without the Prefer: return=query-result header, the server would
> just create a new resource and return a 201 response.
> >>>   If server honors the prefer header, then the server will not only
> create a new resource, but also execute the query based on the query
> definition.
> >>>   The response body will contain the result of the query execution,
> such as:
> >>>   201 Created
> >>>   Preference-Applied: return=query-result
> >>>   Location: http://example.com/employees/searches/q1
> >>>   Content-Location: http://example.com/employees/searches/q1/result
> >>>
> >>>   {
> >>>     "items": [
> >>>       {"name": "foo",
> >>>        "age": 35,
> >>>        "startdate": "2008-02-15"}
> >>>     ]
> >>>   }
> >>>
> >>> o  Preference: return
> >>>
> >>> o  Value: query-result
> >>>
> >>> o  Optional Parameters: n/a
> >>>
> >>> o  Description: It is used to indicate that result of the query
> execution is preferred in the response.
> >>>
> >>> o  Reference: Oracle will add a new sub type (type=query-def) in
> application/vnd.oracle.resource+json media type. This new sub type uses
> return=query-result prefer header.
> >>>    The application/vnd.oracle.resource+json media type is defined at:
> >>>
> http://www.oracle.com/webfolder/technetwork/tutorials/appdevinfo/New%20REST%20Media%20Type.pdf
> >>>
> >>> o  Notes: It is related to another request to add "transient" prefer
> header.
> >>>
> >>>
> >>>   Thanks and appreciate your review.
> >>>
> >>>
> >>> Ning
> >
>
>