Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Documenting query parameters with API Blueprint

I'm trying to document a query parameter in API Blueprint, but I'm not entirely sure if I have done it correctly. The resource looks like this:

DELETE http://baasar.apiary-mock.com/user/{appId}/{userId}

That request would deactivate the user while the following would delete the user object:

DELETE http://baasar.apiary-mock.com/user/{appId}/{userId}?force=true

This is the Blueprint markdown I have for this:

## User [/user/{appId}/{userId}]
Handle user objects

+ Parameters
    + appId (required, number, `1`) ... Application ID (`appId`)
    + userId (required, number, `1`) ... Numeric `userId` of the User object to manage

### Remove an User [DELETE]
+ Parameters
    + force (optional, boolean, `false`) ... Set to `true` to remove instead of deactivate

+ Response 204

However, when rendering this with Apiary I only see force in the list of parameters, but it is now shown in the example URL. Is that just me misunderstanding the GUI or should query parameters be documented in another way?

like image 533
Sebastian Dahlgren Avatar asked Apr 03 '14 18:04

Sebastian Dahlgren


People also ask

How do I write a parameter query in API?

To add query string parameters, a question mark( ? ) is added to the endpoint, after the base URL and path parameters (if any). Following the ? are the query strings which specify specific parameters and values. The parameters can be chained on, one right after the other with an ampersand( & ) separating them.

What is an API query parameter?

What are API Query Parameters? API Query parameters can be defined as the optional key-value pairs that appear after the question mark in the URL. Basically, they are extensions of the URL that are utilized to help determine specific content or action based on the data being delivered.

How do you write a parameter in a query?

Query parameters are a defined set of parameters attached to the end of a url. They are extensions of the URL that are used to help define specific content or actions based on the data being passed. To append query params to the end of a URL, a '? ' Is added followed immediately by a query parameter.

How do you use apiary?

To use Apiary to design APIs, click 'Apiary'. Use your GitHub account to start API design. Once logged in, the UI gives an option to create a new API. Specify a name and click the “Create API” button.


1 Answers

Your blueprint is perfectly fine, the problem is that the current Apiary documentation does not handle URI parameters correctly.

Could you please try the new documentation out? It should handle URI parameters properly.

URI Parameters

Edit

The correct URI Template should be:

http://baasar.apiary-mock.com/user/{appId}/{userId}{?force}
like image 154
Baggz Avatar answered Sep 19 '22 14:09

Baggz