Subject: [apps-discuss] returning something from http 402

From: Melvin Carvalho <[email-masked]>
Date: Wed, 24 Jun 2015 15:59:17 +0200

There has been some talk for a while at the w3c payments CG on fleshing out
HTTP 402 -- "Payment Required" -- return code

Consider a resource that requires payment.  Perhaps the user does not have
enough in their balance to view a page, so a 402 response is issued.

What would be nice would be some additional information returned to the
client to tell them things like how to pay, their balance, the cost etc.

Any thoughts on the best thing to return?

Right now I'm thinking a Location: header might be the solution.

Other options:
- An HTML page
- A content negotiated data page
- Another header with information
- Another header that redirects

I've been looking at the various existing codes 4xx and 2xx and ideally
would like to follow a similar pattern that exists already.

Would love to hear any thoughts on this!

---

From: Ken Murchison <[email-masked]>
Date: Wed, 24 Jun 2015 10:10:44 -0400

On 06/24/2015 09:59 AM, Melvin Carvalho wrote:
> There has been some talk for a while at the w3c payments CG on 
> fleshing out HTTP 402 -- "Payment Required" -- return code
>
> Consider a resource that requires payment. Perhaps the user does not 
> have enough in their balance to view a page, so a 402 response is issued.
>
> What would be nice would be some additional information returned to 
> the client to tell them things like how to pay, their balance, the 
> cost etc.
>
> I've been looking at the various existing codes 4xx and 2xx and 
> ideally would like to follow a similar pattern that exists already.
>

Perhaps leverage 
https://tools.ietf.org/html/draft-ietf-appsawg-http-problem-00

-- 
Kenneth Murchison
Principal Systems Software Engineer
Carnegie Mellon University

---

From: Melvin Carvalho <[email-masked]>
Date: Wed, 24 Jun 2015 16:53:59 +0200

On 24 June 2015 at 16:10, Ken Murchison <[email-masked]> wrote:

>> There has been some talk for a while at the w3c payments CG on fleshing
>> out HTTP 402 -- "Payment Required" -- return code
>>

Thanks, this is pretty neat!  (tho expired)

It describes the problem really well.  Tho instead of 403, we'd probably
like to use 402.

Being a web oriented group, we'd probably be looking to leverage existing
w3c RECs, such as RDF / linked data.

It's great that RDFa is mentioned in the doc.  I suspect the serializations
I would be working with would be JSON-LD and Turtle.

Given the JSON response is open ended, it aligns quite well with JSON LD,
by adding a context and id.  In JSON LD @type is not mandatory, but it
seems to be in this draft.  Similarly the content type I think is different
( application/ld+json )

Otherwise it's a close match.

Just a general question.  Does anyone have thoughts on the pros and cons of
inlining the response, vs some kind of redirection e.g. a Location: header?

> _______________________________________________
> apps-discuss mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/apps-discuss
>

---

From: Erik Wilde <[email-masked]>
Date: Wed, 24 Jun 2015 09:45:02 -0700

hello melvin.

On 2015-06-24 07:53, Melvin Carvalho wrote:
> On 24 June 2015 at 16:10, Ken Murchison <[email-masked]
> <mailto:[email-masked]>> wrote:
>     Perhaps leverage
> It's great that RDFa is mentioned in the doc.  I suspect the
> serializations I would be working with would be JSON-LD and Turtle.

currently, the canonical model is defined in JSON. appendix a talks 
about how to represent that model in XML. appendix b talks about "other 
metamodels" and mentions RDF in passing, simply as one example of those 
other metamodels. it would be possible to add more details about how to 
use the canonical model in RDF-land, so that there would be no doubt 
*how* to represent the canonical model in RDF. if there's any interest, 
that's something that could be done in an additional appendix, and 
talking about how that would look in JSON-LD as one RDF representation 
then also would be pretty straightforward.

cheers,

dret.

-- 
erik wilde | mailto:[email-masked]  -  tel:+1-510-2061079 |
            | UC Berkeley  -  School of Information (ISchool) |
            | http://dret.net/netdret http://twitter.com/dret |

---

From: Melvin Carvalho <[email-masked]>
Date: Fri, 26 Jun 2015 23:01:13 +0200

On 24 June 2015 at 18:45, Erik Wilde <[email-masked]> wrote:

> currently, the canonical model is defined in JSON. appendix a talks about
> how to represent that model in XML. appendix b talks about "other
> other metamodels. it would be possible to add more details about how to use
> the canonical model in RDF-land, so that there would be no doubt *how* to
> represent the canonical model in RDF. if there's any interest, that's
> something that could be done in an additional appendix, and talking about
> how that would look in JSON-LD as one RDF representation then also would be
> pretty straightforward.
>

Thanks for getting back!

So I raised http 402 with timbl today, to ask the history.

He did invent ("scribbled down was his term :)") 402 the idea being that
the web should be a platform for both paid and unpaid content.

He said he originally envisioned it as being quite important, else it
wouldnt have been put before 403!

He also said the w3c payments group (either cg/ig/wg there's 3 now!) might
be a good place to standardize 402.

The document you made seems a good fit, do you have thoughts on:

1. The RFC is 4xx and I'd like to do something 402 specific
2. Thoughts on redirecting to a machine readable representation vs
returning a machine readable representtion
3. General thoughts on mime types -- I may be trying to request non JSON
paid media e.g. html or video, and the client may not be expecting the mime
type it gets -- I really need to think through this point more or make a
proof of concept

Would love to hear thoughts.  If there's a better place to discuss this
e.g. the HTTP WG, pls let me know.