chill-bundles/src/Bundle/ChillMainBundle/chill.api.specs.yaml

797 lines
26 KiB
YAML

---
openapi: "3.0.0"
info:
version: "1.0.0"
title: "Chill api"
description: "Api documentation for chill. Currently, work in progress"
servers:
- url: "/api"
description: "Your current dev server"
components:
schemas:
User:
type: object
properties:
id:
type: integer
type:
type: string
enum:
- user
username:
type: string
text:
type: string
Center:
type: object
properties:
id:
type: integer
name:
type: string
Address:
type: object
properties:
address_id:
type: integer
text:
type: string
postcode:
type: object
properties:
name:
type: string
Country:
type: object
properties:
id:
type: integer
name:
type: object
countryCode:
type: string
PostalCode:
type: object
properties:
id:
type: integer
name:
type: string
code:
type: string
country:
type: object
properties:
id:
type: integer
name:
type: object
countryCode:
type: string
AddressReference:
type: object
properties:
id:
type: integer
refId:
type: string
street:
type: string
streetNumber:
type: string
postcode:
type: object
properties:
id:
type: integer
name:
type: string
code:
type: string
country:
type: object
properties:
id:
type: integer
name:
type: object
countryCode:
type: string
municipalityCode:
type: string
source:
type: string
point:
type: object
properties:
type:
type: string
coordinates:
type: array
items:
type: number
minItems: 2
maxItems: 2
UserJob:
type: object
properties:
id:
type: integer
label:
type: object
type:
type: string
paths:
/1.0/search.json:
get:
summary: perform a search across multiple entities
tags:
- search
- person
- thirdparty
- household
description: >
The search is performed across multiple entities. The entities must be listed into
`type` parameters.
The results are ordered by relevance, from the most to the lowest relevant.
parameters:
- name: q
in: query
required: true
description: the pattern to search
schema:
type: string
- name: type[]
in: query
required: true
description: the type entities amongst the search is performed
schema:
type: array
items:
type: string
enum:
- person
- thirdparty
- user
- household
responses:
200:
description: "OK"
/1.0/main/address.json:
get:
tags:
- address
summary: Return a list of all Chill addresses
responses:
200:
description: "ok"
post:
tags:
- address
summary: create a new address
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
buildingName:
type: string
corridor:
type: string
distribution:
type: string
extra:
type: string
flat:
type: string
floor:
type: string
isNoAddress:
type: boolean
point:
type: array
items:
type: number
minItems: 2
maxItems: 2
postcode:
$ref: '#/components/schemas/PostalCode'
steps:
type: string
street:
type: string
streetNumber:
type: string
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
422:
description: "Unprocessable entity (validation errors)"
400:
description: "transition cannot be applyed"
patch:
tags:
- address
summary: patch an address
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
buildingName:
type: string
corridor:
type: string
distribution:
type: string
extra:
type: string
flat:
type: string
floor:
type: string
isNoAddress:
type: boolean
point:
type: array
items:
type: number
minItems: 2
maxItems: 2
postcode:
$ref: '#/components/schemas/PostalCode'
steps:
type: string
street:
type: string
streetNumber:
type: string
validFrom:
type: string
validTo:
type: string
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
422:
description: "Unprocessable entity (validation errors)"
400:
description: "transition cannot be applyed"
/1.0/main/address/{id}.json:
get:
tags:
- address
summary: Return an address by id
parameters:
- name: id
in: path
required: true
description: The address id
schema:
type: integer
format: integer
minimum: 1
responses:
200:
description: "ok"
content:
application/json:
schema:
$ref: '#/components/schemas/Address'
404:
description: "not found"
401:
description: "Unauthorized"
/1.0/main/address/{id}/duplicate.json:
post:
tags:
- address
summary: Duplicate an existing address
parameters:
- name: id
in: path
required: true
description: The address id that will be duplicated
schema:
type: integer
format: integer
minimum: 1
responses:
200:
description: "ok"
content:
application/json:
schema:
$ref: '#/components/schemas/Address'
404:
description: "not found"
401:
description: "Unauthorized"
/1.0/main/address-reference.json:
get:
tags:
- address
summary: Return a list of all reference addresses
parameters:
- in: query
name: postal_code
required: false
schema:
type: integer
description: The id of a postal code to filter the reference addresses
responses:
200:
description: "ok"
/1.0/main/address-reference/{id}.json:
get:
tags:
- address
summary: Return a reference address by id
parameters:
- name: id
in: path
required: true
description: The reference address id
schema:
type: integer
format: integer
minimum: 1
responses:
200:
description: "ok"
content:
application/json:
schema:
$ref: '#/components/schemas/AddressReference'
404:
description: "not found"
401:
description: "Unauthorized"
/1.0/main/address-reference/by-postal-code/{id}/search.json:
get:
tags:
- address
- search
summary: Return a reference address by id
parameters:
- name: id
in: path
required: true
description: The reference address id
schema:
type: integer
format: integer
minimum: 1
- name: q
in: query
required: true
description: The search pattern
schema:
type: string
responses:
200:
description: "ok"
content:
application/json:
schema:
$ref: '#/components/schemas/AddressReference'
404:
description: "not found"
401:
description: "Unauthorized"
400:
description: "Bad request"
/1.0/main/postal-code.json:
get:
tags:
- address
summary: Return a list of all postal-code
parameters:
- in: query
name: country
required: false
schema:
type: integer
description: The id of a country to filter the postal code
responses:
200:
description: "ok"
post:
tags:
- address
summary: create a new PostalCode
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
code:
type: string
country:
$ref: '#/components/schemas/Country'
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
422:
description: "Unprocessable entity (validation errors)"
400:
description: "transition cannot be applyed"
/1.0/main/postal-code/{id}.json:
get:
tags:
- address
summary: Return a postal code by id
parameters:
- name: id
in: path
required: true
description: The postal code id
schema:
type: integer
format: integer
minimum: 1
responses:
200:
description: "ok"
content:
application/json:
schema:
$ref: '#/components/schemas/PostalCode'
404:
description: "not found"
401:
description: "Unauthorized"
/1.0/main/postal-code/search.json:
get:
tags:
- address
- search
summary: Search a postal code
parameters:
- name: q
in: query
required: true
description: The search pattern
schema:
type: string
- name: country
in: query
required: false
description: The country id
schema:
type: integer
responses:
200:
description: "ok"
content:
application/json:
schema:
$ref: '#/components/schemas/PostalCode'
404:
description: "not found"
400:
description: "Bad Request"
/1.0/main/country.json:
get:
tags:
- address
summary: Return a list of all countries
responses:
200:
description: "ok"
/1.0/main/country/{id}.json:
get:
tags:
- address
summary: Return a country by id
parameters:
- name: id
in: path
required: true
description: The country id
schema:
type: integer
format: integer
minimum: 1
responses:
200:
description: "ok"
content:
application/json:
schema:
$ref: '#/components/schemas/Country'
404:
description: "not found"
401:
description: "Unauthorized"
/1.0/main/user.json:
get:
tags:
- user
summary: Return a list of all user
responses:
200:
description: "ok"
/1.0/main/whoami.json:
get:
tags:
- user
summary: Return the currently authenticated user
responses:
200:
description: "ok"
/1.0/main/user-current-location.json:
get:
tags:
- user
summary: Return the current location of the currently authenticated user
responses:
200:
description: "ok"
/1.0/main/user/{id}.json:
get:
tags:
- user
summary: Return a user by id
parameters:
- name: id
in: path
required: true
description: The user id
schema:
type: integer
format: integer
minimum: 1
responses:
200:
description: "ok"
content:
application/json:
schema:
$ref: '#/components/schemas/User'
404:
description: "not found"
401:
description: "Unauthorized"
/1.0/main/scope.json:
get:
tags:
- scope
summary: return a list of scopes
responses:
200:
description: "ok"
401:
description: "Unauthorized"
/1.0/main/scope/{id}.json:
get:
tags:
- scope
summary: return a list of scopes
parameters:
- name: id
in: path
required: true
description: The scope id
schema:
type: integer
format: integer
minimum: 1
responses:
200:
description: "ok"
401:
description: "Unauthorized"
/1.0/main/location.json:
get:
tags:
- location
summary: Return a list of locations
responses:
200:
description: "ok"
401:
description: "Unauthorized"
post:
tags:
- location
summary: create a new location
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
type:
type: string
name:
type: string
phonenumber1:
type: string
phonenumber2:
type: string
email:
type: string
address:
type: object
properties:
id:
type: integer
locationType:
type: object
properties:
id:
type: integer
type:
type: string
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
422:
description: "Unprocessable entity (validation errors)"
400:
description: "transition cannot be applyed"
/1.0/main/location/{id}.json:
get:
tags:
- location
summary: Return the given location
parameters:
- name: id
in: path
required: true
description: The location id
schema:
type: integer
format: integer
minimum: 1
responses:
200:
description: "ok"
401:
description: "Unauthorized"
/1.0/main/location-type.json:
get:
tags:
- location
summary: Return a list of location types
responses:
200:
description: "ok"
401:
description: "Unauthorized"
/1.0/main/permissions/info.json:
post:
tags:
- permissions
summary: Return info about permissions on entity
responses:
200:
description: "ok"
401:
description: "Unauthorized"
400:
description: "Bad request"
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
object:
type: object
class:
type: string
roles:
type: array
items:
type: string
examples:
an-accompanying-period:
value:
object:
type: accompanying_period
id: 1
class: 'Chill\PersonBundle\Entity\AccompanyingPeriod'
roles:
- 'CHILL_PERSON_ACCOMPANYING_PERIOD_SEE'
/1.0/main/notification/{id}/mark/read:
post:
tags:
- notification
summary: mark a notification as read
parameters:
- name: id
in: path
required: true
description: The notification id
schema:
type: integer
format: integer
minimum: 1
responses:
202:
description: "accepted"
403:
description: "unauthorized"
/1.0/main/notification/{id}/mark/unread:
post:
tags:
- notification
summary: mark a notification as unread
parameters:
- name: id
in: path
required: true
description: The notification id
schema:
type: integer
format: integer
minimum: 1
responses:
202:
description: "accepted"
403:
description: "unauthorized"
/1.0/main/user-job.json:
get:
tags:
- user
summary: Return a list of all user jobs
responses:
200:
description: "ok"
content:
application/json:
schema:
$ref: '#/components/schemas/UserJob'