3

We have one existing API, which we're trying to build a Blueprint for, that requires certain request bodies to be URI-encoded JSON.

Is there some way to specify a body as "like this, but encoded"?

Existing (mere text) documentation just shows the JSON, along with an airy reminder to encode it before sending:

POST /blah/blah/blah
Content-Type: application/x-www-form-urlencoded
Parameters: (x-www-form-urlencoded)

        { "title": "Buy cheese and bread for breakfast." }

But with Blueprint—and especially with Blueprint at apiary.io—you really have to show the actual body. Which is completely unreadable:

### Create a Note [POST]
+ Request (application/x-www-form-urlencoded)

        %7B%20%22title%22%3A%20%22Buy%20cheese%20and%20bread%20for%20breakfast.%22%20%7D

But specifying the readable text in the Blueprint fails (returns a parameter error):

### Create a Note [POST]
+ Request (application/x-www-form-urlencoded)

        { "title": "Buy cheese and bread for breakfast." }

The real sticking point is when I have Apiary talk to my real server: the readable request fails (because it's not encoded), while the unreadable one succeeds (because, as required, it is).

jackr
  • 1,407
  • 1
  • 14
  • 29
  • So if I am correct, the question is whether it is possible to state an unencoded JSON for a message-body of the `application/x-www-form-urlencoded` Conten-Type so the API Blueprint (parser) would encode it during the parsing? – Zdenek Nov 13 '13 at 19:36
  • Yes, that's the idea. – jackr Jan 09 '14 at 00:15

1 Answers1

0

I believe this is something not yet support but which is being tracked here: https://github.com/apiaryio/api-blueprint/issues/25

PETER BROWN
  • 550
  • 6
  • 14