Created
March 28, 2016 09:24
-
-
Save clodio/2105e3974fa950f4e710 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "swagger": "2.0", | |
| "info": { | |
| "description": "# Swagger template\n\n\nThis is a swagger template for your api, you should adpat exemples to your context and add a description of the purpose af the API. You should also replase todo with your data.\n\n# Routes\n\n\n ```\n GET data/v1/products\n GET data/v1/products/search?q=\n GET data/v1/products/:id\n POST data/v1/products\n POST data/v1/products/:id\n PATCH data/v1/products/:id\n PUT data/v1/products/:id\n DELETE data/v1/products/:id\n GET data/v1/products/swagger.yaml\n GET data/v1/products/postman.json\n ```\n\n# SubRoutes\n\nRessources can be linked to others, in this case subRessource will have a products_id field with the value :id\n\n\n ```\n GET data/v1/products/:id/_subRessource\n GET data/v1/products/:id/_subRessource/search?q=\n GET data/v1/products/:id/_subRessource/:subRessource_id\n POST data/v1/products/:id/_subRessource\n POST data/v1/products/:id/_subRessource/:subRessource_id\n PATCH data/v1/products/:id/_subRessource/:subRessource_id\n PUT data/v1/products/:id/_subRessource/:subRessource_id\n DELETE data/v1/products/:id/_subRessource/:subRessource_id\n ```\n\n# Partial data\n\nAdd fields= to retrieve only some fields (Use . to access deep properties)\n\n\n ```\n GET data/v1/products?fields=id,name\n GET data/v1/products?fields=adress\n GET data/v1/products?fields=adress.locality\n ```\n\n\n# Filter\n\nUse . to access deep properties\n\n\n ```\n GET data/v1/products?title=elastifull&author=clodio\n GET data/v1/products?id=1,2\n GET data/v1/products?id=1&id=2\n GET data/v1/products?author.name=clodio\n ```\n\n# Pagination\n\nAdd start_index and/or count (pagination and total_results will be included in response with next and previous link)\n\n\n ```\n GET data/v1/products?start_index=20\n GET data/v1/products?start_index=20&count=3\n {\n \"data\":[...],\n \"paging\": {\n \"total_results\":30,\n \"prev\": \"http://localhost:1337/data/v1/products?start_index=17&count=3\",\n \"next\": \"http://localhost:1337/data/v1/products?start_index=23&count=3\",\n }\n }\n\n ```\n\n\n\n# Operators\n\nAdd _gte, _gt, _lte, _lt for getting a range\n\n\n ```\n GET data/v1/products?price_gte=10&price_lte=20\n GET data/v1/products?creation_date_gte=now-1d/d\n GET data/v1/products?creation_date_gte=now-1d\n GET data/v1/products?creation_date_gte=2014-06-18T23:59:59Z\n ```\n\n\nAdd _ne to exclude a value\n\n\n ```\n GET data/v1/products?price_ne=20\n ```\n\n\nadd _exists=true to find records with the field, _exists=false to find records without fields\n\n\n ```\n GET data/v1/products?address.locality_exists=true\n GET data/v1/products?address.locality_exists=false\n ```\n\n\nAdd _like to filter using like\n\n\n ```\n GET data/v1/products?title_like=server*\n ```\n\n\nAdd _prefix to filter with prefix\n\n\n ```\n GET data/v1/products?name_prefix=cl\n ```\n\n\nAdd _regex to filter with RegExp\n\n\n ```\n GET data/v1/products?name_regex=clo.?dio\n ```\n\n\nAdd _fuzzy to filter with fuzzy search\n\n\n ```\n GET data/v1/products?votes_fuzzy=2 --> votes : 1,2,3\n GET data/v1/products?name_fuzzy=cladio --> name : clodio\n GET data/v1/products?votes_fuzzy=cldio --> name : clodio\n ```\n\n\n\nFull-text search\n\nAdd /search?q= to do a full search on all fields\n\n\n ```\n GET data/v1/products/search?q=*c\n ```\n\n\n# Dates\n\ncreation_date and modification_date are automatically managed with RFC3369\n\n\n ```\n Ex 2014-06-18T23:59:59Z\n ```\n\n\nYou can use now, now-1d, now+1d/d,... when searching/filtering (see elastic.co)\n\n ```\n GET data/v1/products?creation_date_gte=now-1d\n ```\n\n\n\n# Etag\n\nAll ressources have a version, you can use it to cache data or to modify a specific version\n\n\n ```\n GET data/v1/products/1\n ```\n\n\n--> send a etag header and a etag inside the result\n\nyou can use header If-None-Match to retrieve data only if modified, to modify data only if not modified\n# Automatic or managed data definitions with elasticsearch\n\nYou can create a new ressource or a new field easily by calling POST, if you want to manage precisely types of your data. You must use elastic mapping to precise types of data. By defaut, all the fields will considered as string, expect automatic creation_date and modification_date\n\ncreate index\n\n\n ```\n curl -XPUT 'http://localhost:9200/data_products/'\n ```\n\n\ncreate mapping\n\n\n ```\n curl -XPUT 'http://localhost:9200/data_products/_mapping/products' \\\n -d'{\n \"products\": {\n \"properties\":\n {\n \"creation_date\":{\n \"type\":\"date\",\"format\":\"strict_date_optional_time||epoch_millis\"\n },\n \n \"id\":{\n \"type\":\"string\"\n },\n \n \"modification_date\":{\n \"type\":\"date\",\"format\":\"strict_date_optional_time||epoch_millis\"\n },\n \n \"name\":{\n \"type\":\"string\"\n },\n \n \"price\":{\n \"type\":\"long\"\n },\n \n \"status\":{\n \"type\":\"string\"\n }\n }\n }\n }'\n ```\n\nRetrieve mapping\n\n\n ```\n curl -XGET http://localhost:9200/data_products/_mapping/products\n ```\n\n\n# Business Intelligence\n\nSince data are stored in ELK you can make graphs with kibana, and use specific elastic request (aggregations,...)\n\nsee https://www.elastic.co/products/kibana\n\n\n# Swagger\n\nYou can get a swagger template of the Restull API\n\n\n ```\n GET http://localhost:1337/data/v1/products/swagger.yaml\n ```\n\n\n# Postman\n\nYou can get a postman template of the Restull API\n\n\n ```\n GET http://localhost:1337/data/v1/products/postman.json\n ```", | |
| "version": "v1", | |
| "title": "data:products RestFul API", | |
| "termsOfService": "https://wiki.collaboratif-courrier.fr/confluence/display/APEX/", | |
| "contact": { | |
| "name": "--# your name and email --", | |
| "email": "[email protected]" | |
| } | |
| }, | |
| "host": "localhost:1337", | |
| "basePath": "/data/v1", | |
| "securityDefinitions": { | |
| "bearer": { | |
| "type": "apiKey", | |
| "name": "Authorization", | |
| "in": "header", | |
| "description": "\nheader `Authorization` to add in all calls\n\nUse the `readonly` account\n\n\n ```\n eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NsYXVkZS1pZHAubGFwb3N0ZS5mciIsInBybiI6ImNsYXVkZS5zZWd1cmV0QGxhcG9zdGUuZnIiLCJhdWQiOiJodHRwczovL2NsYXVkZS1hdXRoLmxhcG9zdGUuZnIiLCJleHAiOiIxNDYxNTYxNzIxIiwic2NvcGVzIjpbInJlc3NvdXJjZXMucmVhZCJdfQ.ssrAHB1phB3hGh4n2t7rBJQAJP5GQWM5Qtvg7tR7UwA\n ```\n\nOr use the `readwrite` account\n\n\n ```\n eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NsYXVkZS1pZHAubGFwb3N0ZS5mciIsInBybiI6ImNsYXVkZS5zZWd1cmV0QGxhcG9zdGUuZnIiLCJhdWQiOiJodHRwczovL2NsYXVkZS1hdXRoLmxhcG9zdGUuZnIiLCJleHAiOiIxNDYxNTYxNzIxIiwic2NvcGVzIjpbInJlc3NvdXJjZXMucmVhZCIsInJlc3NvdXJjZXMud3JpdGUiXX0.rn6BGkwXv1bqaevBuroqNoBDP6d8dNo3dN1f6kwPqNU\n ```\n\nor use the `write` account\n\n\n ```\n eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NsYXVkZS1pZHAubGFwb3N0ZS5mciIsInBybiI6ImNsYXVkZS5zZWd1cmV0QGxhcG9zdGUuZnIiLCJhdWQiOiJodHRwczovL2NsYXVkZS1hdXRoLmxhcG9zdGUuZnIiLCJleHAiOiIxNDYxNTYxNzIxIiwic2NvcGVzIjpbInJlc3NvdXJjZXMud3JpdGUiXX0.ltmMFRJuiBaw79InBvDsu2uJ1wqr2nJ4rOdTJTIcXrU\n ```\n" | |
| } | |
| }, | |
| "tags": [ | |
| { | |
| "name": "readOnly", | |
| "description": "API services that can only be readed" | |
| }, | |
| { | |
| "name": "readWrite", | |
| "description": "API services that can be readed and writed" | |
| }, | |
| { | |
| "name": "write", | |
| "description": "Ressources that can only be writed" | |
| } | |
| ], | |
| "schemes": [ | |
| "http" | |
| ], | |
| "paths": { | |
| "/products": { | |
| "get": { | |
| "tags": [ | |
| "readOnly", | |
| "readWrite" | |
| ], | |
| "summary": "Retrieve a list of products", | |
| "description": "\n\nRetrieve products with differents search criteria, pagination and a filter on attributes.\n\nExample with pagination criteria\n\n\n ```\n curl -iX GET \\\n -H 'Accept: application/json' \\\n -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NsYXVkZS1pZHAubGFwb3N0ZS5mciIsInBybiI6ImNsYXVkZS5zZWd1cmV0QGxhcG9zdGUuZnIiLCJhdWQiOiJodHRwczovL2NsYXVkZS1hdXRoLmxhcG9zdGUuZnIiLCJleHAiOiIxNDYxNTYxNzIxIiwic2NvcGVzIjpbInJlc3NvdXJjZXMucmVhZCIsInJlc3NvdXJjZXMud3JpdGUiXX0.rn6BGkwXv1bqaevBuroqNoBDP6d8dNo3dN1f6kwPqNU' \\\n \"http://localhost:1337/data/v1/products?start_index=1&count=10\"\n ```\n\nExample with dates criteria\n\n\n ```\n curl -iX GET \\\n -H 'Accept: application/json' \\\n -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NsYXVkZS1pZHAubGFwb3N0ZS5mciIsInBybiI6ImNsYXVkZS5zZWd1cmV0QGxhcG9zdGUuZnIiLCJhdWQiOiJodHRwczovL2NsYXVkZS1hdXRoLmxhcG9zdGUuZnIiLCJleHAiOiIxNDYxNTYxNzIxIiwic2NvcGVzIjpbInJlc3NvdXJjZXMucmVhZCIsInJlc3NvdXJjZXMud3JpdGUiXX0.rn6BGkwXv1bqaevBuroqNoBDP6d8dNo3dN1f6kwPqNU' \\\n \"http://localhost:1337/data/v1/products?creation_date_gte=2015-06-18T00:00:00Z\"\n ```\n\nExample with filter on retrieved attributes\n\n\n ```\n curl -iX GET \\\n -H 'Accept: application/json' \\\n -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NsYXVkZS1pZHAubGFwb3N0ZS5mciIsInBybiI6ImNsYXVkZS5zZWd1cmV0QGxhcG9zdGUuZnIiLCJhdWQiOiJodHRwczovL2NsYXVkZS1hdXRoLmxhcG9zdGUuZnIiLCJleHAiOiIxNDYxNTYxNzIxIiwic2NvcGVzIjpbInJlc3NvdXJjZXMucmVhZCIsInJlc3NvdXJjZXMud3JpdGUiXX0.rn6BGkwXv1bqaevBuroqNoBDP6d8dNo3dN1f6kwPqNU' \\\n \"http://localhost:1337/data/v1/products?creation_date_gte=2015-06-18T00:00:00Z&fields=id,modification_date\"\n ```\n", | |
| "operationId": "listProducts", | |
| "produces": [ | |
| "application/json" | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "query", | |
| "name": "fields", | |
| "description": "List of attributes to retrieved (comma separator) Ex ?fields=id,creation_date\n", | |
| "required": false, | |
| "type": "string" | |
| }, | |
| { | |
| "in": "query", | |
| "name": "start_index", | |
| "description": "First item to retrieved (start at 1)", | |
| "required": false, | |
| "type": "integer", | |
| "format": "int64" | |
| }, | |
| { | |
| "in": "query", | |
| "name": "count", | |
| "description": "Number of item to retrieve (default 30, max 1000)", | |
| "maximum": 1000, | |
| "required": false, | |
| "type": "integer", | |
| "format": "int64" | |
| }, | |
| { | |
| "in": "header", | |
| "name": "If-None-Match", | |
| "description": "Version of the ressource (see etag) (Ex : 1)", | |
| "required": false, | |
| "type": "string" | |
| } | |
| ], | |
| "security": [ | |
| { | |
| "bearer": [] | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "successful operation", | |
| "schema": { | |
| "$ref": "#/definitions/PaginationProducts" | |
| } | |
| }, | |
| "304": { | |
| "description": "not modified" | |
| }, | |
| "400": { | |
| "description": "Bad request, parameters are not correct", | |
| "schema": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/definitions/Error" | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized, the authentification is invalid or missing" | |
| }, | |
| "403": { | |
| "description": "Forbidden, permissions are insufficient" | |
| }, | |
| "429": { | |
| "description": "Too many requests" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| }, | |
| "503": { | |
| "description": "Temporary unavailable", | |
| "schema": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/definitions/Error" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "post": { | |
| "tags": [ | |
| "readWrite", | |
| "write" | |
| ], | |
| "summary": "Create a ressource products", | |
| "description": "Create a ressource products\n\n\n ```\n curl -iX POST \\\n -H 'Accept: application/json' \\\n -H 'Content-Type: application/json; charset=utf-8' \\\n -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NsYXVkZS1pZHAubGFwb3N0ZS5mciIsInBybiI6ImNsYXVkZS5zZWd1cmV0QGxhcG9zdGUuZnIiLCJhdWQiOiJodHRwczovL2NsYXVkZS1hdXRoLmxhcG9zdGUuZnIiLCJleHAiOiIxNDYxNTYxNzIxIiwic2NvcGVzIjpbInJlc3NvdXJjZXMucmVhZCIsInJlc3NvdXJjZXMud3JpdGUiXX0.rn6BGkwXv1bqaevBuroqNoBDP6d8dNo3dN1f6kwPqNU' \\\n -d '{\"name\":\"my product\",\"status\":\"available\",\"price\":12,\"creation_date\":\"2016-03-27T08:15:29Z\",\"modification_date\":\"2016-03-27T08:15:29Z\",\"etag\":1}' \\\n 'http://localhost:1337/data/v1/products'\n ```\n", | |
| "operationId": "createProducts", | |
| "consumes": [ | |
| "application/x-www-form-urlencoded" | |
| ], | |
| "produces": [ | |
| "application/json" | |
| ], | |
| "security": [ | |
| { | |
| "bearer": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "body", | |
| "name": "body", | |
| "description": "ressource products", | |
| "required": false, | |
| "schema": { | |
| "$ref": "#/definitions/Products" | |
| } | |
| } | |
| ], | |
| "responses": { | |
| "201": { | |
| "description": "Created", | |
| "schema": { | |
| "$ref": "#/definitions/Products" | |
| } | |
| }, | |
| "304": { | |
| "description": "not modified" | |
| }, | |
| "400": { | |
| "description": "Bad request, parameters are not correct", | |
| "schema": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/definitions/Error" | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized, the authentification is invalid or missing" | |
| }, | |
| "403": { | |
| "description": "Forbidden, permissions are insufficient" | |
| }, | |
| "404": { | |
| "description": "Not found" | |
| }, | |
| "412": { | |
| "description": "Precondition failed, versions conflit" | |
| }, | |
| "429": { | |
| "description": "Too many requests" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| }, | |
| "503": { | |
| "description": "Temporary unavailable", | |
| "schema": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/definitions/Error" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/products/{id}": { | |
| "get": { | |
| "tags": [ | |
| "readOnly", | |
| "readWrite" | |
| ], | |
| "summary": "Retrieve one ressource products", | |
| "description": "\nRetrieve the ressource products `daloka086EJfTSFlRg` with filter on attributes\n\n ```\n curl -iX GET \\\n -H 'Accept: application/json' \\\n -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NsYXVkZS1pZHAubGFwb3N0ZS5mciIsInBybiI6ImNsYXVkZS5zZWd1cmV0QGxhcG9zdGUuZnIiLCJhdWQiOiJodHRwczovL2NsYXVkZS1hdXRoLmxhcG9zdGUuZnIiLCJleHAiOiIxNDYxNTYxNzIxIiwic2NvcGVzIjpbInJlc3NvdXJjZXMucmVhZCIsInJlc3NvdXJjZXMud3JpdGUiXX0.rn6BGkwXv1bqaevBuroqNoBDP6d8dNo3dN1f6kwPqNU' \\\n -H \"If-None-Match: 1\" \\\n \"http://localhost:1337/data/v1/products/daloka086EJfTSFlRg?fields=id,creation_date,modification_date\"\n ```\n", | |
| "operationId": "getOneProducts", | |
| "produces": [ | |
| "application/json" | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "id", | |
| "description": "Unique identifier of the ressource products to retrieve (Ex: daloka086EJfTSFlRg)", | |
| "required": true, | |
| "type": "string" | |
| }, | |
| { | |
| "in": "query", | |
| "name": "fields", | |
| "description": "List of attributes to retrieved (comma separator) (Ex : ?fields=id,creation_date)", | |
| "required": false, | |
| "type": "string" | |
| }, | |
| { | |
| "in": "header", | |
| "name": "If-None-Match", | |
| "description": "Version of the ressource (see etag) (Ex : 1)", | |
| "required": false, | |
| "type": "string" | |
| } | |
| ], | |
| "security": [ | |
| { | |
| "bearer": [] | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "successful operation", | |
| "schema": { | |
| "$ref": "#/definitions/Products" | |
| } | |
| }, | |
| "304": { | |
| "description": "not modified" | |
| }, | |
| "400": { | |
| "description": "Bad request, parameters are not correct", | |
| "schema": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/definitions/Error" | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized, the authentification is invalid or missing" | |
| }, | |
| "403": { | |
| "description": "Forbidden, permissions are insufficient" | |
| }, | |
| "404": { | |
| "description": "Not found" | |
| }, | |
| "429": { | |
| "description": "Too many requests" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| }, | |
| "503": { | |
| "description": "Temporary unavailable", | |
| "schema": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/definitions/Error" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "put": { | |
| "tags": [ | |
| "readWrite", | |
| "write" | |
| ], | |
| "summary": "Full update a ressource products", | |
| "description": "\nFull update the ressource products `daloka086EJfTSFlRg`\n\n\n ```\n curl -iX PUT \\\n -H 'Accept: application/json' \\\n -H 'Content-Type: application/json; charset=utf-8' \\\n -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NsYXVkZS1pZHAubGFwb3N0ZS5mciIsInBybiI6ImNsYXVkZS5zZWd1cmV0QGxhcG9zdGUuZnIiLCJhdWQiOiJodHRwczovL2NsYXVkZS1hdXRoLmxhcG9zdGUuZnIiLCJleHAiOiIxNDYxNTYxNzIxIiwic2NvcGVzIjpbInJlc3NvdXJjZXMucmVhZCIsInJlc3NvdXJjZXMud3JpdGUiXX0.rn6BGkwXv1bqaevBuroqNoBDP6d8dNo3dN1f6kwPqNU' \\\n -d '{\"name\":\"my product\",\"status\":\"available\",\"price\":12,\"creation_date\":\"2016-03-27T08:15:29Z\",\"modification_date\":\"2016-03-27T08:15:29Z\",\"etag\":1}' \\\n \"http://localhost:1337/data/v1/products/daloka086EJfTSFlRg\"\n ```\n", | |
| "operationId": "fullUpdateOneProducts", | |
| "consumes": [ | |
| "application/x-www-form-urlencoded" | |
| ], | |
| "produces": [ | |
| "application/json" | |
| ], | |
| "security": [ | |
| { | |
| "bearer": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "id", | |
| "description": "Unique identifier of the ressource products to update (Ex: daloka086EJfTSFlRg)", | |
| "required": true, | |
| "type": "string" | |
| }, | |
| { | |
| "in": "body", | |
| "name": "body", | |
| "description": "ressource products", | |
| "required": false, | |
| "schema": { | |
| "$ref": "#/definitions/Products" | |
| } | |
| }, | |
| { | |
| "in": "header", | |
| "name": "If-None-Match", | |
| "description": "Version of the ressource (see etag) (Ex : 1)", | |
| "required": false, | |
| "type": "string" | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Successful operation", | |
| "schema": { | |
| "$ref": "#/definitions/Products" | |
| } | |
| }, | |
| "201": { | |
| "description": "Created", | |
| "schema": { | |
| "$ref": "#/definitions/Products" | |
| } | |
| }, | |
| "400": { | |
| "description": "Bad request, parameters are not correct", | |
| "schema": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/definitions/Error" | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized, the authentification is invalid or missing" | |
| }, | |
| "403": { | |
| "description": "Forbidden, permissions are insufficient" | |
| }, | |
| "412": { | |
| "description": "Precondition failed, versions conflit" | |
| }, | |
| "429": { | |
| "description": "Too many requests" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| }, | |
| "503": { | |
| "description": "Temporary unavailable", | |
| "schema": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/definitions/Error" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "post": { | |
| "tags": [ | |
| "readWrite", | |
| "write" | |
| ], | |
| "summary": "Partial update (one or more attributes) a ressource products", | |
| "description": "Partial update the ressource products `daloka086EJfTSFlRg`\n\n\n ```\n curl -iX POST \\\n -H 'Accept: application/json' \\\n -H 'Content-Type: application/json; charset=utf-8' \\\n -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NsYXVkZS1pZHAubGFwb3N0ZS5mciIsInBybiI6ImNsYXVkZS5zZWd1cmV0QGxhcG9zdGUuZnIiLCJhdWQiOiJodHRwczovL2NsYXVkZS1hdXRoLmxhcG9zdGUuZnIiLCJleHAiOiIxNDYxNTYxNzIxIiwic2NvcGVzIjpbInJlc3NvdXJjZXMucmVhZCIsInJlc3NvdXJjZXMud3JpdGUiXX0.rn6BGkwXv1bqaevBuroqNoBDP6d8dNo3dN1f6kwPqNU' \\\n -d '{\"name\":\"my product\",\"status\":\"available\",\"price\":12,\"creation_date\":\"2016-03-27T08:15:29Z\",\"modification_date\":\"2016-03-27T08:15:29Z\",\"etag\":1}' \\\n \"http://localhost:1337/data/v1/products/daloka086EJfTSFlRg\"\n ```\n", | |
| "operationId": "partialUpdateProducts", | |
| "consumes": [ | |
| "application/x-www-form-urlencoded" | |
| ], | |
| "produces": [ | |
| "application/json" | |
| ], | |
| "security": [ | |
| { | |
| "bearer": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "id", | |
| "description": "Unique identifier of the ressource products to update (Ex: daloka086EJfTSFlRg)", | |
| "required": true, | |
| "type": "string" | |
| }, | |
| { | |
| "in": "body", | |
| "name": "body", | |
| "description": "ressource products", | |
| "required": false, | |
| "schema": { | |
| "$ref": "#/definitions/Products" | |
| } | |
| }, | |
| { | |
| "in": "header", | |
| "name": "If-None-Match", | |
| "description": "Version of the ressource (see etag) (Ex : 1)", | |
| "required": false, | |
| "type": "string" | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "successful operation", | |
| "schema": { | |
| "$ref": "#/definitions/Products" | |
| } | |
| }, | |
| "304": { | |
| "description": "not modified" | |
| }, | |
| "400": { | |
| "description": "Bad request, parameters are not correct", | |
| "schema": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/definitions/Error" | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized, the authentification is invalid or missing" | |
| }, | |
| "403": { | |
| "description": "Forbidden, permissions are insufficient" | |
| }, | |
| "404": { | |
| "description": "Not found" | |
| }, | |
| "412": { | |
| "description": "Precondition failed, versions conflit" | |
| }, | |
| "429": { | |
| "description": "Too many requests" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| }, | |
| "503": { | |
| "description": "Temporary unavailable", | |
| "schema": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/definitions/Error" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "patch": { | |
| "tags": [ | |
| "readWrite", | |
| "write" | |
| ], | |
| "summary": "Partial update (one or more attributes) a ressource products", | |
| "description": "Partial update the ressource products `daloka086EJfTSFlRg`\n\n\n ```\n curl -iX PATCH \\\n -H 'Accept: application/json' \\\n -H 'Content-Type: application/json; charset=utf-8' \\\n -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NsYXVkZS1pZHAubGFwb3N0ZS5mciIsInBybiI6ImNsYXVkZS5zZWd1cmV0QGxhcG9zdGUuZnIiLCJhdWQiOiJodHRwczovL2NsYXVkZS1hdXRoLmxhcG9zdGUuZnIiLCJleHAiOiIxNDYxNTYxNzIxIiwic2NvcGVzIjpbInJlc3NvdXJjZXMucmVhZCIsInJlc3NvdXJjZXMud3JpdGUiXX0.rn6BGkwXv1bqaevBuroqNoBDP6d8dNo3dN1f6kwPqNU' \\\n -d '{\"name\":\"my product\",\"status\":\"available\",\"price\":12,\"creation_date\":\"2016-03-27T08:15:29Z\",\"modification_date\":\"2016-03-27T08:15:29Z\",\"etag\":1}' \\\n \"http://localhost:1337/data/v1/products/daloka086EJfTSFlRg\"\n ```\n", | |
| "operationId": "patchProducts", | |
| "consumes": [ | |
| "application/x-www-form-urlencoded" | |
| ], | |
| "produces": [ | |
| "application/json" | |
| ], | |
| "security": [ | |
| { | |
| "bearer": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "id", | |
| "description": "Unique identifier of the ressource products to update (Ex: daloka086EJfTSFlRg)", | |
| "required": true, | |
| "type": "string" | |
| }, | |
| { | |
| "in": "body", | |
| "name": "body", | |
| "description": "ressource products", | |
| "required": false, | |
| "schema": { | |
| "$ref": "#/definitions/Products" | |
| } | |
| }, | |
| { | |
| "in": "header", | |
| "name": "If-None-Match", | |
| "description": "Version of the ressource (see etag) (Ex : 1)", | |
| "required": false, | |
| "type": "string" | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "successful operation", | |
| "schema": { | |
| "$ref": "#/definitions/Products" | |
| } | |
| }, | |
| "304": { | |
| "description": "not modified" | |
| }, | |
| "400": { | |
| "description": "Bad request, parameters are not correct", | |
| "schema": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/definitions/Error" | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized, the authentification is invalid or missing" | |
| }, | |
| "403": { | |
| "description": "Forbidden, permissions are insufficient" | |
| }, | |
| "404": { | |
| "description": "Not found" | |
| }, | |
| "412": { | |
| "description": "Precondition failed, versions conflit" | |
| }, | |
| "429": { | |
| "description": "Too many requests" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| }, | |
| "503": { | |
| "description": "Temporary unavailable", | |
| "schema": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/definitions/Error" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "delete": { | |
| "tags": [ | |
| "readWrite", | |
| "write" | |
| ], | |
| "summary": "Delete a ressource products", | |
| "description": "Delete the ressource products `daloka086EJfTSFlRg`\n\n\n ```\n curl -iX DELETE \\\n -H 'Accept: application/json' \\\n -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NsYXVkZS1pZHAubGFwb3N0ZS5mciIsInBybiI6ImNsYXVkZS5zZWd1cmV0QGxhcG9zdGUuZnIiLCJhdWQiOiJodHRwczovL2NsYXVkZS1hdXRoLmxhcG9zdGUuZnIiLCJleHAiOiIxNDYxNTYxNzIxIiwic2NvcGVzIjpbInJlc3NvdXJjZXMucmVhZCIsInJlc3NvdXJjZXMud3JpdGUiXX0.rn6BGkwXv1bqaevBuroqNoBDP6d8dNo3dN1f6kwPqNU' \\\n \"http://localhost:1337/data/v1/products/daloka086EJfTSFlRg\"\n ```\n", | |
| "operationId": "deleteOneProducts", | |
| "produces": [ | |
| "application/json" | |
| ], | |
| "security": [ | |
| { | |
| "bearer": [] | |
| } | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "path", | |
| "name": "id", | |
| "description": "Unique identifier of the ressource products to delete (Ex: daloka086EJfTSFlRg)", | |
| "required": true, | |
| "type": "string" | |
| }, | |
| { | |
| "in": "header", | |
| "name": "If-None-Match", | |
| "description": "Version of the ressource (see etag) (Ex : 1)", | |
| "required": false, | |
| "type": "string" | |
| } | |
| ], | |
| "responses": { | |
| "204": { | |
| "description": "Deleted" | |
| }, | |
| "401": { | |
| "description": "Unauthorized, the authentification is invalid or missing" | |
| }, | |
| "403": { | |
| "description": "Forbidden, permissions are insufficient" | |
| }, | |
| "404": { | |
| "description": "Not found" | |
| }, | |
| "429": { | |
| "description": "Too many requests" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| }, | |
| "503": { | |
| "description": "Temporary unavailable", | |
| "schema": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/definitions/Error" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/products/search": { | |
| "get": { | |
| "tags": [ | |
| "readOnly", | |
| "readWrite" | |
| ], | |
| "summary": "Fulltext search on all attribute of products", | |
| "description": "\nSearch ressources products with differents search criteria, pagination and a filter on attributes.\n\nExample with pagination criteria\n\n\n ```\n curl -iX GET \\\n -H 'Accept: application/json' \\\n -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NsYXVkZS1pZHAubGFwb3N0ZS5mciIsInBybiI6ImNsYXVkZS5zZWd1cmV0QGxhcG9zdGUuZnIiLCJhdWQiOiJodHRwczovL2NsYXVkZS1hdXRoLmxhcG9zdGUuZnIiLCJleHAiOiIxNDYxNTYxNzIxIiwic2NvcGVzIjpbInJlc3NvdXJjZXMucmVhZCIsInJlc3NvdXJjZXMud3JpdGUiXX0.rn6BGkwXv1bqaevBuroqNoBDP6d8dNo3dN1f6kwPqNU' \\\n \"http://localhost:1337/data/v1/products/search?q=v*&start_index=1&count=10\"\n ```\n\nExample with dates criteria\n\n\n ```\n curl -iX GET \\\n -H 'Accept: application/json' \\\n -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NsYXVkZS1pZHAubGFwb3N0ZS5mciIsInBybiI6ImNsYXVkZS5zZWd1cmV0QGxhcG9zdGUuZnIiLCJhdWQiOiJodHRwczovL2NsYXVkZS1hdXRoLmxhcG9zdGUuZnIiLCJleHAiOiIxNDYxNTYxNzIxIiwic2NvcGVzIjpbInJlc3NvdXJjZXMucmVhZCIsInJlc3NvdXJjZXMud3JpdGUiXX0.rn6BGkwXv1bqaevBuroqNoBDP6d8dNo3dN1f6kwPqNU' \\\n \"http://localhost:1337/data/v1/products/search?q=v*&creation_date_gte=2015-06-18T00:00:00Z\"\n ```\n\nExample with filter on retrieved attributes\n\n\n ```\n curl -iX GET \\\n -H 'Accept: application/json' \\\n -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NsYXVkZS1pZHAubGFwb3N0ZS5mciIsInBybiI6ImNsYXVkZS5zZWd1cmV0QGxhcG9zdGUuZnIiLCJhdWQiOiJodHRwczovL2NsYXVkZS1hdXRoLmxhcG9zdGUuZnIiLCJleHAiOiIxNDYxNTYxNzIxIiwic2NvcGVzIjpbInJlc3NvdXJjZXMucmVhZCIsInJlc3NvdXJjZXMud3JpdGUiXX0.rn6BGkwXv1bqaevBuroqNoBDP6d8dNo3dN1f6kwPqNU' \\\n \"http://localhost:1337/data/v1/products/search?q=v*&creation_date_gte=2015-06-18T00:00:00Z&fields=id,modification_date\"\n ```\n", | |
| "operationId": "searchProducts", | |
| "produces": [ | |
| "application/json" | |
| ], | |
| "parameters": [ | |
| { | |
| "in": "query", | |
| "name": "q", | |
| "description": "champs de recherche fulltext\nEx ?q=recherh*\n", | |
| "required": false, | |
| "type": "string" | |
| }, | |
| { | |
| "in": "query", | |
| "name": "fields", | |
| "description": "List of attributes to retrieved (comma separator) Ex ?fields=id,creation_date\n", | |
| "required": false, | |
| "type": "string" | |
| }, | |
| { | |
| "in": "query", | |
| "name": "start_index", | |
| "description": "First item to retrieved (start at 1)", | |
| "default": 1, | |
| "required": false, | |
| "type": "integer", | |
| "format": "int64" | |
| }, | |
| { | |
| "in": "query", | |
| "name": "count", | |
| "description": "Number of item to retrieve (default 10, max 999)", | |
| "default": 20, | |
| "maximum": 999, | |
| "required": false, | |
| "type": "integer", | |
| "format": "int64" | |
| }, | |
| { | |
| "in": "header", | |
| "name": "If-None-Match", | |
| "description": "Version of the ressource (see etag) (Ex : 1)", | |
| "required": false, | |
| "type": "string" | |
| } | |
| ], | |
| "security": [ | |
| { | |
| "bearer": [] | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "successful operation", | |
| "schema": { | |
| "$ref": "#/definitions/PaginationProducts" | |
| } | |
| }, | |
| "304": { | |
| "description": "not modified" | |
| }, | |
| "400": { | |
| "description": "Bad request, parameters are not correct", | |
| "schema": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/definitions/Error" | |
| } | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized, the authentification is invalid or missing" | |
| }, | |
| "403": { | |
| "description": "Forbidden, permissions are insufficient" | |
| }, | |
| "429": { | |
| "description": "Too many requests" | |
| }, | |
| "500": { | |
| "description": "Internal server error" | |
| }, | |
| "503": { | |
| "description": "Temporary unavailable", | |
| "schema": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/definitions/Error" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "definitions": { | |
| "PaginationProducts": { | |
| "description": "Pagination format", | |
| "properties": { | |
| "paginate": { | |
| "$ref": "#/definitions/PaginateProducts" | |
| }, | |
| "products": { | |
| "type": "array", | |
| "description": "Ressources List, empty if none", | |
| "items": { | |
| "$ref": "#/definitions/Products" | |
| } | |
| } | |
| } | |
| }, | |
| "PaginateProducts": { | |
| "description": "Pagination links and number of items", | |
| "properties": { | |
| "next": { | |
| "type": "string", | |
| "description": "Link href to consult next page ex 'http://localhost:1337/products/v1/products?start_index=21&count=10'\n" | |
| }, | |
| "prev": { | |
| "type": "string", | |
| "description": "Link to consult previous page\nex 'http://localhost:1337/products/v1/products?start_index=1&count=10'\n" | |
| }, | |
| "total_results": { | |
| "type": "integer", | |
| "format": "int64", | |
| "description": "Total number of items (ex 27)" | |
| } | |
| } | |
| }, | |
| "Error": { | |
| "description": "Error format", | |
| "required": [ | |
| "error" | |
| ], | |
| "properties": { | |
| "error_description": { | |
| "type": "string", | |
| "description": "long description error message (ex 'A user must have an email address')" | |
| }, | |
| "error": { | |
| "type": "string", | |
| "description": "error name to describe the error, ex \"invalid_user\"" | |
| } | |
| } | |
| }, | |
| "Products": { | |
| "description": "products format model", | |
| "properties": { | |
| "creation_date": { | |
| "type": "string", | |
| "format": "date-time", | |
| "description": "todo describe", | |
| "example": "2014-06-18T23:59:58.000Z" | |
| }, | |
| "id": { | |
| "type": "string", | |
| "description": "unique identifier of the ressource", | |
| "example": "daloka086EJfTSFlRg" | |
| }, | |
| "modification_date": { | |
| "type": "string", | |
| "format": "date-time", | |
| "description": "todo describe", | |
| "example": "2014-06-18T23:59:58.000Z" | |
| }, | |
| "name": { | |
| "type": "string", | |
| "description": "todo describe", | |
| "example": "my product" | |
| }, | |
| "price": { | |
| "type": "integer", | |
| "format": "int64", | |
| "description": "todo describe", | |
| "example": 12 | |
| }, | |
| "status": { | |
| "type": "string", | |
| "description": "todo describe", | |
| "example": "available" | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment