Reputation: 1405
I have the following definition in apiary for a service to post access rights:
## Access Right [/api/v0.3/accessrights/{id}/assign?isExternalKey=true]
### Assign access rights [Post]
+ accessRightId (number)
+ personId (string)
+ Parameters
+ id (number) - ID of the Access Right in the form of an integer
+ Request (application/json)
{
"personId": "785"
}
+ Response 201
Apiary tell me that the Request and the Response block are unrecognized. I tried to make the fields required, I made the parameter required, I changed the spelling of the fields, I removed the (application/json), i fiddled with the spacing. Nothing seems to help. What is wrong with the Request and Response block?
Upvotes: 1
Views: 1758
Reputation: 5893
Method names must be all-caps, as in the spec and on wire.
Therefore, the "Assign access rights" line should be written as follows:
### Assign access rights [POST]
Upvotes: 1
Reputation: 1405
By switching the order of the blocks (from Parameters, Request, Response to Request, Response, Parameters), the request and response body are recognized:
## Access Right [/api/v0.3/accessrights/{id}/assign?isExternalKey=true]
### Assign access rights [Post]
+ accessRightId (number)
+ personId (string)
+ Request (application/json)
{
"personId": "785"
}
+ Response 201
+ Parameters
+ id (number) - ID of the Access Right in the form of an integer
I am not sure why that matters, but at least now the API validates as Valid API Blueprint. The problem is solved!
Upvotes: 0