How to format a POST request on apiary.io?

thanks for your time I have a POST request that I want to document in the project apiary, the title looks something like this:

text / html

_method: POST

data [User] [username]:

data [User] [password]:

data [User] [remember]: 0

http://d.pr/i/uRFx

I have something like this, but I'm not sure how to end it:

## login [/users/login/{username}{password}{remember}{ident}] Login with a user and password + Parameters + username (required, string, `myname`) ... the username format should follow CakePHP: data[User][username]. + password (required, string, `whatever`) ... the password format should follow CakePHP: data[User][password] + remember (required, number, `0`) ... the remember format should follow CakePHP: data[User][remember] + ident (optional, number, `0`) ... the ident format should follow CakePHP: data[User][ident] ### make login [POST] + login by user (text/plain) What goes in here??????????? 

any idea? Thanks!

+7
apiblueprint
source share
1 answer

Apparently this is sending data in a web form . In this case, the Content-Type is of type application/x-www-form-urlencoded .

The body of the request message has special formatting, and some of its charters (square brackets) must be% -shielded. For more information on formatting the request body, see the above Wiki article .

The Blueprint API in its simplest form might look something like this:

 # Login [/users/login] ## Make Login [POST] + Request (application/x-www-form-urlencoded) data%5BUser%5D%5Busername%5D=qq&data%5BUser%5D%5Bpassword%5Dqq&data%5BUser%5D%5Bremember%5D=0 + Response 201 

You should be able to see your example request message body in your traffic inspector under the link "URL encoded URL".

Refer to this project to see this example in action.

Also see this SO question for more details on application/x-www-form-urlencoded .

+11
source share

All Articles