openapi: 3.0.0 info: description: 'The Admin service allows to manage API keys and unpaywall data.' version: 1.0.0 title: Admin service contact: email: ezteam@couperin.org name: ezTeam license: name: CeCILL 2.1 url: http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.html servers: - url: https://unpaywall.inist.fr/api/admin tags: - name: ping - name: apikey - name: admin - name: cron - name: mail paths: /: get: tags: - ping operationId: get summary: Name of service. description: Get name of service. responses: '200': description: OK content: application/json: examples: response: value: message: admin service /ping: get: operationId: get-ping summary: Ping admin service. description: Ping admin service. tags: - ping responses: '204': description: No Content /status: get: tags: - ping operationId: get-status summary: Status. description: status on all service connected to admin service. parameters: [] responses: '200': description: OK content: application/json: schema: type: object properties: redis: type: object properties: elapsedTime: type: integer status: type: boolean elastic: type: object properties: elapsedTime: type: integer status: type: boolean elapsedTime: type: integer status: type: boolean x-examples: Example 1: redis: elapsedTime: 1 status: true elastic: elapsedTime: 1 status: true elapsedTime: 1 status: true examples: Success: value: redis: elapsedTime: 1 status: true elastic: elapsedTime: 1 status: true elapsedTime: 1 status: true Error redis: value: redis: elapsedTime: 3001 status: false error: time out elastic: elapsedTime: 1 status: true elapsedTime: 3001 status: false /healthcheck: get: tags: - ping operationId: get-healthcheck summary: Checking the health of the service description: Returns a status of 204 if the service is available responses: '204': description: No Content /apikey/keys/${apikey}: get: tags: - apikey summary: Get config of apikey operationId: get-apikey-keys-$-apikey description: Get config of apikey parameters: - in: path name: apikey description: apikey required: true schema: type: string responses: '200': description: config of apikey content: application/json: schema: type: object properties: apikey: type: string default: azerty name: type: string default: john doe attributes: type: array items: type: string default: '*' access: type: array items: type: string default: graphql allowed: type: boolean put: tags: - apikey summary: Update apikey operationId: put-apikeys-keys-$-apikey description: Update apikey security: - x-api-key: [] parameters: - in: path name: apikey description: apikey required: true schema: type: string responses: '200': description: update apikey content: application/json: schema: type: object properties: apikey: type: string default: azerty name: type: string default: john doe attributes: type: array items: type: string default: '*' access: type: array items: type: string default: graphql allowed: type: boolean examples: John Doe apikey: value: apikey: azerty name: john doe attributes: - '*' access: - graphql allowed: true '400': description: Bad Request content: application/json: schema: type: object properties: message: type: string x-examples: example-1: message: '"name" is required' examples: Name is required: value: message: '"name" is required' '401': $ref: '#/components/responses/Not-authorized' delete: tags: - apikey summary: Delete apikey operationId: delete-apikey-keys-$-apikey description: Delete apikey security: - x-api-key: [] parameters: - in: path name: apikey description: apikey required: true schema: type: string responses: '204': description: apikey deleted '401': $ref: '#/components/responses/Not-authorized' /apikey/keys: get: tags: - apikey summary: Get all config of all apikey operationId: get-apikey-keys description: Get all config of all apikey security: - x-api-key: [] responses: '200': description: update apikey content: application/json: schema: type: array items: type: object properties: apikey: type: string default: azerty name: type: string default: john doe attributes: type: array items: type: string default: '*' access: type: array items: type: string default: graphql allowed: type: boolean examples: John doe apikey: value: - apikey: azerty name: john doe attributes: - '*' access: - graphql allowed: true apikey of John Doe: examples: response: value: - apikey: azerty123456 name: John Doe attributes: - '*' access: - graphql allowed: true '401': $ref: '#/components/responses/Not-authorized' delete: tags: - apikey summary: Delete all apikey operationId: delete-apikey-keys description: Delete all apikey security: - x-api-key: [] responses: '204': description: all apikey are deleted '401': $ref: '#/components/responses/Not-authorized' post: tags: - apikey summary: Create apikey operationId: post-apikey-keys description: Create new apikey security: - x-api-key: [] requestBody: content: application/json: schema: type: object properties: name: type: string attributes: type: array items: type: string access: type: array items: type: string allowed: type: boolean description: config for apikey required: true responses: '200': description: update apikey content: application/json: schema: type: object properties: apikey: type: string default: azerty name: type: string default: john doe attributes: type: array items: type: string default: '*' access: type: array items: type: string default: graphql allowed: type: boolean '401': $ref: '#/components/responses/Not-authorized' /apikey/keys/load: post: tags: - apikey summary: Load apikey operationId: post-apikeys-keys-load description: Load apikey security: - x-api-key: [] requestBody: content: application/json: schema: type: array items: type: object properties: apikey: type: string name: type: string attributes: type: array items: type: string access: type: array items: type: string allowed: type: boolean x-examples: example-1: - apikey: string name: string attributes: - string access: - string allowed: true examples: example-1: value: - apikey: string name: string attributes: - string access: - string allowed: true description: apikeys required: true responses: '204': description: all apikey are loaded '401': $ref: '#/components/responses/Not-authorized' /login: post: tags: - admin summary: Login. operationId: post-login description: Login. security: - x-api-key: [] responses: '204': description: No Content '401': $ref: '#/components/responses/Not-authorized' /config: get: tags: - admin summary: get config of service. operationId: get-config description: Get config or service with hidden secrets. security: - x-api-key: [] responses: '200': description: config content: Config: examples: response: value: nodeEnv: development timezone: Europe/Paris smtp: host: maildev port: 25 notifications: sender: ezunpaywall receivers: - ezunpaywall@example.com machine: dev unpaywall: url: http://fakeunpaywall:3000 apikey: "********" elasticsearch: nodes: http://elastic:9200 username: elastic password: "********" timeout: 20000 redis: host: redis port: "6379" password: "********" cron: cleanFile: schedule: "0 0 0 * * *" active: true paths: log: applicationDir: ./log/application accessDir: ./log/access healthcheckDir: ./log/healthcheck apikey: "********" healthTimeout: 3000 '401': $ref: '#/components/responses/Not-authorized' /cron/${type}/start: post: tags: - cron operationId: post-cron-start summary: Start cron. description: Start cron. security: - x-api-key: [] parameters: - in: path name: type description: type of cron required: true schema: type: string responses: '202': $ref: '#/components/responses/Accepted' '401': $ref: '#/components/responses/Not-authorized' /cron/${type}/stop: post: tags: - cron operationId: post-cron-stop description: Stop cron. summary: Stop cron. security: - x-api-key: [] parameters: - in: path name: type description: type of cron required: true schema: type: string responses: '202': $ref: '#/components/responses/Accepted' '401': $ref: '#/components/responses/Not-authorized' /cron/${type}: patch: tags: - cron operationId: patch-cron summary: update cron. description: update config of cron. security: - x-api-key: [] parameters: - in: path name: type description: type of cron required: true schema: type: string requestBody: content: application/json: schema: type: object properties: time: type: string index: type: string interval: type: string x-examples: example-1: time: '' index: '' interval: '' examples: daily: value: time: 0 0 0 * * * index: unpaywall interval: day weekly: value: time: 0 0 0 * * 0 index: unpaywall interval: weekly responses: '200': description: OK content: application/json: schema: type: object properties: config: type: object properties: time: type: string status: type: boolean index: type: string interval: type: string x-examples: example-1: config: time: '* * * * * *' status: false index: unpaywall interval: day examples: updated: value: config: time: '* 30 12-15 * * *' status: true index: unpaywall interval: day '401': $ref: '#/components/responses/Not-authorized' get: tags: - cron operationId: get-cron summary: Get config of cron. description: Get config of cron. parameters: - in: path name: type description: type of cron (dataUpdate or dataUpdateHistory) required: true schema: type: string responses: '200': description: OK content: application/json: schema: type: object properties: config: type: object properties: time: type: string status: type: boolean index: type: string interval: type: string x-examples: example-1: config: time: '* * * * * *' status: false index: unpaywall interval: day examples: day: value: config: time: 0 0 0 * * * status: true index: unpaywall interval: day week: value: config: time: 0 0 0 * * * status: true index: unpaywall interval: day off: value: config: time: 0 0 0 * * * status: false index: unpaywall interval: day /contact: post: tags: - mail operationId: post-mail summary: Send contact mail. description: Send contact mail. security: - x-api-key: [] requestBody: content: application/json: schema: type: object properties: email: type: string subject: type: string message: type: string responses: '202': $ref: '#/components/responses/Accepted' '401': $ref: '#/components/responses/Not-authorized' components: responses: Accepted: description: Accepted headers: {} Not-authorized: description: Not authorized headers: {} content: application/json: examples: response: value: message: Not authorized Error-date: description: startDate cannot be in the future or endDate cannot be lower than startDate. headers: {} content: application/json: examples: response: value: message: startDate cannot be in the future or endDate cannot be lower than startDate. Conflict: description: Conflict headers: {} content: application/json: examples: response: value: message: Update in progress. File-not-found: description: File not found headers: {} content: application/json: examples: response: value: message: File not found. securitySchemes: x-api-key: type: apiKey in: header name: API Key schemas: {}