Merge pull request #2783 from betagouv/api-doc

Change the link to the API documentation
This commit is contained in:
gregoirenovel 2018-10-09 17:30:13 +02:00 committed by GitHub
commit cbb59f175d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 3 additions and 364 deletions

View file

@ -87,10 +87,6 @@ gem 'bootstrap-wysihtml5-rails', '~> 0.3.3.8'
gem 'spreadsheet_architect' gem 'spreadsheet_architect'
gem 'axlsx', '~> 3.0.0.pre' # https://github.com/randym/axlsx/issues/501#issuecomment-373640365 gem 'axlsx', '~> 3.0.0.pre' # https://github.com/randym/axlsx/issues/501#issuecomment-373640365
gem 'apipie-rails'
# For Markdown support in apipie
gem 'maruku'
gem 'openstack' gem 'openstack'
gem 'browser' gem 'browser'

View file

@ -89,8 +89,6 @@ GEM
selectize-rails (~> 0.6) selectize-rails (~> 0.6)
aes_key_wrap (1.0.1) aes_key_wrap (1.0.1)
after_party (1.10.0) after_party (1.10.0)
apipie-rails (0.5.10)
rails (>= 4.1)
arel (9.0.0) arel (9.0.0)
ast (2.4.0) ast (2.4.0)
attr_required (1.0.1) attr_required (1.0.1)
@ -483,7 +481,6 @@ GEM
rest-client rest-client
marcel (0.3.2) marcel (0.3.2)
mimemagic (~> 0.3.2) mimemagic (~> 0.3.2)
maruku (0.7.3)
method_source (0.9.0) method_source (0.9.0)
mime-types (3.1) mime-types (3.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
@ -812,7 +809,6 @@ DEPENDENCIES
active_model_serializers active_model_serializers
administrate administrate
after_party after_party
apipie-rails
axlsx (~> 3.0.0.pre) axlsx (~> 3.0.0.pre)
bcrypt bcrypt
bootstrap-sass (~> 3.3.5) bootstrap-sass (~> 3.3.5)
@ -858,7 +854,6 @@ DEPENDENCIES
lograge lograge
logstash-event logstash-event
mailjet mailjet
maruku
mina! mina!
omniauth-github omniauth-github
openid_connect openid_connect
@ -906,4 +901,4 @@ DEPENDENCIES
zxcvbn-ruby zxcvbn-ruby
BUNDLED WITH BUNDLED WITH
1.16.5 1.16.6

View file

@ -3,17 +3,6 @@ class API::V1::DossiersController < APIController
DEFAULT_PAGE_SIZE = 100 DEFAULT_PAGE_SIZE = 100
resource_description do
description AUTHENTICATION_TOKEN_DESCRIPTION
end
api :GET, '/procedures/:procedure_id/dossiers/', 'Liste de tous les dossiers d\'une démarche'
param :procedure_id, Integer, desc: "L'identifiant de la démarche", required: true
param :page, String, desc: "Numéro de la page", required: false
param :resultats_par_page, String, desc: "Nombre de résultats par page (#{DEFAULT_PAGE_SIZE} par défaut, maximum 1 000)", required: false
error code: 401, desc: "Non authorisé"
error code: 404, desc: "Démarche inconnue"
def index def index
dossiers = @procedure.dossiers.state_not_brouillon.page(params[:page]).per(per_page) dossiers = @procedure.dossiers.state_not_brouillon.page(params[:page]).per(per_page)
@ -22,12 +11,6 @@ class API::V1::DossiersController < APIController
render json: {}, status: 404 render json: {}, status: 404
end end
api :GET, '/procedures/:procedure_id/dossiers/:id', 'Informations du dossier d\'une démarche'
param :procedure_id, Integer, desc: "L'identifiant de la démarche", required: true
param :dossier_id, Integer, desc: "L'identifiant du dossier", required: true
error code: 401, desc: "Non authorisé"
error code: 404, desc: "Démarche ou dossier inconnu"
def show def show
dossier = @procedure.dossiers.find(params[:id]) dossier = @procedure.dossiers.find(params[:id])

View file

@ -1,15 +1,6 @@
class API::V1::ProceduresController < APIController class API::V1::ProceduresController < APIController
before_action :fetch_procedure_and_check_token before_action :fetch_procedure_and_check_token
resource_description do
description AUTHENTICATION_TOKEN_DESCRIPTION
end
api :GET, '/procedures/:id', 'Informations concernant une démarche'
param :id, Integer, desc: "L'identifiant de la démarche", required: true
error code: 401, desc: "Non authorisé"
error code: 404, desc: "Démarche inconnue"
def show def show
render json: { procedure: ProcedureSerializer.new(@procedure.decorate).as_json } render json: { procedure: ProcedureSerializer.new(@procedure.decorate).as_json }
end end

View file

@ -1,12 +1,4 @@
class APIController < ApplicationController class APIController < ApplicationController
AUTHENTICATION_TOKEN_DESCRIPTION = <<-EOS
L'authentification de l'API se fait via un header HTTP :
```
Authorization: Bearer &lt;Token administrateur&gt;
```
EOS
before_action :default_format_json before_action :default_format_json
protected protected

View file

@ -34,7 +34,7 @@
%li.footer-link %li.footer-link
= link_to "Documentation", DOC_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer" = link_to "Documentation", DOC_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"
%li.footer-link %li.footer-link
= link_to "Documentation de l'API", "/docs", :class => "footer-link", :target => "_blank", rel: "noopener noreferrer" = link_to "Documentation de l'API", API_DOC_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"
%li.footer-link %li.footer-link
= link_to "FAQ", FAQ_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer" = link_to "FAQ", FAQ_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"
%li.footer-link %li.footer-link

View file

@ -1,19 +0,0 @@
Apipie.configure do |config|
config.app_name = "API demarches-simplifiees.fr"
config.api_base_url = "/api/v1"
config.doc_base_url = "/docs"
config.api_controllers_matcher = Rails.root.join("app", "controllers"," api", "v1", "**", "*.rb")
config.markup = Apipie::Markup::Markdown.new
config.default_version = '1.0'
config.validate = false
config.namespaced_resources = true
config.show_all_examples = true
config.languages = ['fr']
config.default_locale = 'fr'
config.app_info = <<~EOS
Description
EOS
end

View file

@ -13,4 +13,5 @@ DOC_URL = "https://doc.demarches-simplifiees.fr"
LISTE_DES_DEMARCHES_URL = [DOC_URL, "listes-des-demarches"].join("/") LISTE_DES_DEMARCHES_URL = [DOC_URL, "listes-des-demarches"].join("/")
CGU_URL = [DOC_URL, "cgu"].join("/") CGU_URL = [DOC_URL, "cgu"].join("/")
MENTIONS_LEGALES_URL = [CGU_URL, "4-mentions-legales"].join("#") MENTIONS_LEGALES_URL = [CGU_URL, "4-mentions-legales"].join("#")
API_DOC_URL = [DOC_URL, "pour-aller-plus-loin", "api"].join("/")
FAQ_URL = "https://faq.demarches-simplifiees.fr" FAQ_URL = "https://faq.demarches-simplifiees.fr"

View file

@ -33,8 +33,6 @@ fr:
previous: Précédent previous: Précédent
first: Premier first: Premier
truncate: '&hellip;' truncate: '&hellip;'
apipie:
api_documentation: "Documentation de l'API demarches-simplifiees.fr"
mail: mail:
administration: administration:

View file

@ -379,8 +379,6 @@ Rails.application.routes.draw do
get 'renew-api-token' => redirect('/profil') get 'renew-api-token' => redirect('/profil')
end end
apipie
# #
# Legacy routes # Legacy routes
# #

View file

@ -1,295 +0,0 @@
{
"dossiers#index": [
{
"verb": "GET",
"path": "/api/v1/procedures/2/dossiers",
"versions": [
"1.0"
],
"query": "token=92cf04673cb66ab57a0c45e085b5140398ab4b6c",
"request_data": null,
"response_data": {
"dossiers": [
{
"id": 2,
"nom_projet": "Demande de subvention dans le cadre d'accompagnement d'enfant à l'étranger",
"updated_at": "2008-09-01T08:05:00.000Z",
"initiated_at": "2008-09-02T08:05:00.000Z"
}
],
"pagination": {
"page": 1,
"resultats_par_page": 12,
"nombre_de_page": 1
}
},
"code": "200",
"show_in_doc": 1,
"recorded": true
}
],
"dossiers#show": [
{
"verb": "GET",
"path": "/api/v1/procedures/1/dossiers/1",
"versions": [
"1.0"
],
"query": "token=7cba5df87cf134d07c3c467eb21b4f2a2b2605be",
"request_data": null,
"response_data": {
"dossier": {
"id": 1,
"nom_projet": "Demande de subvention dans le cadre d'accompagnement d'enfant à l'étranger",
"description": "Ma super description",
"created_at": "2008-09-01T08:05:00.000Z",
"updated_at": "2008-09-01T08:05:00.000Z",
"archived": false,
"state": "initiated",
"simplified_state": "En construction",
"initiated_at": "2017-04-11T12:00:12.000Z",
"received_at": null,
"processed_at": null,
"motivation": null,
"instructeurs": [
"gestionnaire@apientreprise.fr"
],
"invites": [
"nom@domaine.fr"
],
"individual": {
"nom": "Monmari",
"prenom": "René"
},
"entreprise": {
"siren": "440117620",
"capital_social": 537100000,
"numero_tva_intracommunautaire": "FR27440117620",
"forme_juridique": "SA à conseil d'administration (s.a.i.)",
"forme_juridique_code": "5599",
"nom_commercial": "GRTGAZ",
"raison_sociale": "GRTGAZ",
"siret_siege_social": "44011762001530",
"code_effectif_entreprise": "51",
"date_creation": "2016-01-28T10:16:29.000Z",
"nom": null,
"prenom": null
},
"etablissement": {
"siret": "44011762001530",
"siege_social": true,
"naf": "4950Z",
"libelle_naf": "Transports par conduites",
"adresse": "GRTGAZ\r IMMEUBLE BORA\r 6 RUE RAOUL NORDLING\r 92270 BOIS COLOMBES\r",
"numero_voie": "6",
"type_voie": "RUE",
"nom_voie": "RAOUL NORDLING",
"complement_adresse": "IMMEUBLE BORA",
"code_postal": "92270",
"localite": "BOIS COLOMBES",
"code_insee_localite": "92009"
},
"cerfa": null,
"champs": [
{
"value": null,
"type_de_champ": {
"id": 1,
"libelle": "Description",
"type": "textarea",
"order_place": 1,
"description": "description de votre projet"
}
},
{
"value": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
2.3050735,
48.8401501
],
[
2.3052329,
48.8402106
],
[
2.3053759,
48.8400422
],
[
2.3050735,
48.8401501
]
]
]
]
},
"type_de_champ": {
"id": -1,
"libelle": "cadastre",
"type_champ": "cadastre",
"order_place": -1,
"descripton": ""
}
},
{
"value": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
2.3050735,
48.8401501
],
[
2.3052329,
48.8402106
],
[
2.3053759,
48.8400422
],
[
2.3050735,
48.8401501
]
]
]
]
},
"type_de_champ": {
"id": -1,
"libelle": "quartier prioritaire",
"type_champ": "quartier_prioritaire",
"order_place": -1,
"descripton": ""
}
},
{
"value": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
2.3049509525299072,
48.84028511554904
],
[
2.305165529251098,
48.84014035882062
],
[
2.3049670457839966,
48.84005562298059
],
[
2.3049509525299072,
48.84028511554904
]
]
]
]
},
"type_de_champ": {
"id": -1,
"libelle": "user_geometry",
"type_champ": "user_geometry",
"order_place": -1,
"descripton": ""
}
}
],
"champs_private": [
{
"value": null,
"type_de_champ": {
"id": 1,
"libelle": "Description privée",
"type_champ": "text",
"order_place": 0,
"description": "description privée"
}
}
],
"pieces_justificatives": [
{
"url": null,
"type_de_piece_justificative": {
"id": 1,
"libelle": "RIB",
"description": "Releve identité bancaire"
}
},
{
"url": null,
"type_de_piece_justificative": {
"id": 2,
"libelle": "Attestation MSA",
"description": "recuperation automatique"
}
}
]
}
},
"code": "200",
"show_in_doc": 1,
"recorded": true
}
],
"procedures#show": [
{
"verb": "GET",
"path": "/api/v1/procedures/3",
"versions": [
"1.0"
],
"query": "token=cc00dc59ddc89f64c6310bb4e25c55eeb63ee89c",
"request_data": null,
"response_data": {
"procedure": {
"label": "Demande de subvention",
"link": "http://localhost",
"id": 3,
"description": "Demande de subvention à l'intention des associations",
"organisation": "Orga DINSIC",
"direction": "direction DINSIC",
"archived_at": null,
"geographic_information": {
"use_api_carto": true,
"quartiers_prioritaires": true,
"cadastre": true
},
"types_de_champ": [
{
"id": 3,
"libelle": "Description",
"type": "textarea",
"order_place": 1,
"description": "description de votre projet"
}
],
"types_de_piece_justificative": [
{
"id": 5,
"libelle": "RIB",
"description": "Releve identité bancaire"
},
{
"id": 6,
"libelle": "Attestation MSA",
"description": "recuperation automatique"
}
]
}
},
"code": "200",
"show_in_doc": 1,
"recorded": true
}
]
}

View file

@ -111,7 +111,6 @@ RSpec.configure do |config|
config.infer_base_class_for_anonymous_controllers = false config.infer_base_class_for_anonymous_controllers = false
config.run_all_when_everything_filtered = true config.run_all_when_everything_filtered = true
config.filter_run :show_in_doc => true if ENV['APIPIE_RECORD']
config.filter_run :focus => true config.filter_run :focus => true
config.order = 'random' config.order = 'random'