Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate header for apipie-rails gem?

I need to generate an API with apipie-rails, but I want to generate the documentation for the headers like this one "X-User-Email" or "X-User-Token".

I have this resource description:

resource_description do
   short 'Cars'
   formats ['json']
   param 'X-User-Email <X-User-Email>', String, :desc => "HEADER param: Email must correspond to TOKEN owner", :required => false
   param 'X-User-Token <X-User-Token>', String, :desc => "HEADER param: Token must correspond to EMAIL owner", :required => false
   error :code => 401, :desc => "Unauthorized - Returned when authentication can't be achieved via login or missing/expired api token"
end

But, the argument param doesn't help me in this case.

Is this possible?

like image 621
Israel Barba Avatar asked Oct 20 '22 22:10

Israel Barba


1 Answers

You can do something like:

header 'X-User-Email', '...expected value...'
like image 106
SakyHank Avatar answered Nov 01 '22 11:11

SakyHank