2020-06-15 17:44:56 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-05-05 15:02:02 +02:00
|
|
|
Apipie.configure do |config|
|
2020-06-15 17:44:56 +02:00
|
|
|
config.app_name = 'Fab-manager'
|
|
|
|
config.api_base_url = '/open_api'
|
|
|
|
config.doc_base_url = '/open_api/doc'
|
2016-05-05 15:02:02 +02:00
|
|
|
# where is your API defined?
|
2022-08-30 14:16:49 +02:00
|
|
|
config.api_controllers_matcher = Rails.root.join('app/controllers/open_api/v1/*.rb')
|
2016-05-05 15:02:02 +02:00
|
|
|
config.validate = false
|
2020-06-15 17:44:56 +02:00
|
|
|
config.translate = false
|
|
|
|
config.default_locale = nil
|
|
|
|
config.app_info['v1'] = <<-RDOC
|
2016-05-05 15:02:02 +02:00
|
|
|
= Pagination
|
|
|
|
---
|
2022-12-07 10:15:15 +01:00
|
|
|
You can ask for pagination on your requests, by providing the GET parameters *page* and *per_page* (when it's available).
|
|
|
|
The meta-data about pagination will be returned in the headers, following RFC-5988 standard for web linking.
|
2016-05-05 15:02:02 +02:00
|
|
|
It uses headers *Link*, *Total* and *Per-Page*.
|
|
|
|
|
2017-10-05 11:31:50 +02:00
|
|
|
= Authentication
|
2016-05-05 15:02:02 +02:00
|
|
|
---
|
2017-10-05 11:31:50 +02:00
|
|
|
Authentication is done using *Authorization* header.
|
2016-05-05 15:02:02 +02:00
|
|
|
You just have to set header *Authorization* to <tt>Token token=YOUR_TOKEN</tt> for every request.
|
2017-10-05 11:31:50 +02:00
|
|
|
|
|
|
|
= Json
|
|
|
|
---
|
2022-08-30 14:16:49 +02:00
|
|
|
Depending on your client, you may have to set header <tt>Accept: application/json</tt> for every request,
|
2017-10-05 11:31:50 +02:00
|
|
|
otherwise some clients may request *html* by default which will result in error.
|
2022-08-30 14:16:49 +02:00
|
|
|
|
2022-09-06 13:10:05 +02:00
|
|
|
= Amounts
|
|
|
|
---
|
|
|
|
Everywhere in the OpenAPI amounts are reported in cents. For exemple, if you get <tt>{ "amount" : 1000 }</tt>,
|
|
|
|
from the OpenAPI, this means that the price is 10 € (or whatever your currency is).
|
2020-06-15 17:44:56 +02:00
|
|
|
RDOC
|
2016-05-05 15:02:02 +02:00
|
|
|
end
|