openapi: 3.1.0 info: contact: email: contact@passbolt.com description: This is a low-level overview of the API and its endpoints, if you need higher-level guides for interacting with the endpoints, use the Developer guide. license: name: AGPL-3.0 url: https://www.gnu.org/licenses/agpl-3.0.html termsOfService: https://www.passbolt.com/terms title: Passbolt Authentication (GPGAuth) Authentication (GPGAuth) Favorites API version: 5.0.0 servers: - url: https://passbolt.local description: API Passbolt tags: - name: Favorites description: 'The favorite endpoints are used to add or remove a `Resource` from your favorites. ' paths: /favorite/{favoriteId}.json: delete: summary: Unset a resource as favorite. operationId: deleteFavorite security: - bearerHttpAuthentication: [] x-codeSamples: - lang: cURL source: "curl --request DELETE \\\n --url {{API_BASE_URL}}/favorites/9edeffa4-a4fb-4e6a-b5f8-1ffc3f408335.json \\\n --header 'Authorization: Bearer {{JWT_TOKEN}}'\n" - lang: JavaScript source: "const url = '{{API_BASE_URL}}/favorites/9edeffa4-a4fb-4e6a-b5f8-1ffc3f408335.json';\nconst options = {method: 'DELETE', headers: {Authorization: 'Bearer {{JWT_TOKEN}}'}};\n\ntry {\n const response = await fetch(url, options);\n const data = await response.json();\n console.log(data);\n} catch (error) {\n console.error(error);\n}\n" - lang: PHP source: " \"{{API_BASE_URL}}/favorites/9edeffa4-a4fb-4e6a-b5f8-1ffc3f408335.json\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"DELETE\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Bearer {{JWT_TOKEN}}\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}\n" tags: - Favorites parameters: - $ref: '#/components/parameters/favoriteId' responses: '200': $ref: '#/components/responses/nullBody' '400': $ref: '#/components/responses/badRequest' '401': $ref: '#/components/responses/authenticationRequired' '404': $ref: '#/components/responses/notFound' /favorite/{foreignModel}/{foreignId}.json: post: summary: Set a resource as favorite. operationId: addFavorite security: - bearerHttpAuthentication: [] x-codeSamples: - lang: cURL source: "curl --request POST \\\n --url {{API_BASE_URL}}/favorites/resource/42968631-0c51-4405-9f2d-c6700c5057be.json \\\n --header 'Authorization: Bearer {{JWT_TOKEN}}'\n --header 'Content-Type: application/json' \\\n" - lang: JavaScript source: "const url = '{{API_BASE_URL}}/favorites/resource/42968631-0c51-4405-9f2d-c6700c5057be.json';\nconst options = {method: 'POST', headers: {Authorization: 'Bearer {{JWT_TOKEN}}'}};\n\ntry {\n const response = await fetch(url, options);\n const data = await response.json();\n console.log(data);\n} catch (error) {\n console.error(error);\n}\n" - lang: PHP source: " \"{{API_BASE_URL}}/favorites/resource/42968631-0c51-4405-9f2d-c6700c5057be.json\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"POST\",\n CURLOPT_HTTPHEADER => [\n \"Authorization: Bearer {{JWT_TOKEN}}\"\n ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}\n" tags: - Favorites parameters: - $ref: '#/components/parameters/favoritesForeignModel' - $ref: '#/components/parameters/foreignId' responses: '200': $ref: '#/components/responses/favorites_add' '400': $ref: '#/components/responses/badRequest' '401': $ref: '#/components/responses/authenticationRequired' '404': $ref: '#/components/responses/notFound' components: responses: badRequest: description: Bad request content: application/json: schema: type: object required: - header - body properties: header: $ref: '#/components/schemas/header' body: type: string examples: example: value: header: id: 7ff2828c-1092-4897-8e0a-1dc64ada889f status: error servertime: 1721207029 action: 4d0c0996-ce30-4bce-9918-9062ab35c542 message: url: code: 400 body: '' notFound: description: Not found content: application/json: schema: type: object required: - header - body properties: header: $ref: '#/components/schemas/header' body: type: string examples: example: value: header: id: 7ff2828c-1092-4897-8e0a-1dc64ada889f status: error servertime: 1721207029 action: 4d0c0996-ce30-4bce-9918-9062ab35c542 message: The does not exist. url: code: 404 body: '' authenticationRequired: description: Authentication required. content: application/json: schema: type: object required: - header - body properties: header: $ref: '#/components/schemas/header' body: type: string examples: base: value: header: id: f7be85c0-afb1-4d8e-a9e1-e05abb0bb71a status: error servertime: 1721727753 action: e2aa01a9-84ec-55f8-aaed-24ee23259339 message: Authentication is required to continue. url: code: 401 body: '' nullBody: description: Operation is successful. content: application/json: schema: type: object required: - header - body properties: header: $ref: '#/components/schemas/header' body: type: 'null' examples: base: value: header: id: f7be85c0-afb1-4d8e-a9e1-e05abb0bb71a status: success servertime: 1721727753 action: e2aa01a9-84ec-55f8-aaed-24ee23259339 message: url: code: 200 body: null favorites_add: description: Operation is successful content: application/json: schema: type: object required: - header - body properties: header: $ref: '#/components/schemas/header' body: $ref: '#/components/schemas/favorite' examples: base: value: header: id: 7ff2828c-1092-4897-8e0a-1dc64ada889f status: success servertime: 1721207029 action: 4d0c0996-ce30-4bce-9918-9062ab35c542 message: The resource was marked as favorite. url: /favorites/resource/42968631-0c51-4405-9f2d-c6700c5057be.json code: 200 body: id: 90a25878-a6c1-43c1-a983-68d27f2f0be8 user_id: 8bb80df5-700c-48ce-b568-85a60fc3c8f2 foreign_key: 42968631-0c51-4405-9f2d-c6700c5057be foreign_model: Resource created: '2024-08-07T13:39:29+00:00' modified: '2024-08-07T13:39:29+00:00' parameters: favoritesForeignModel: name: foreignModel description: Type for the foreign model being set as favorite. in: path required: true schema: type: string enum: - resource favoriteId: name: favoriteId description: ID for the favorite being manipulated. in: path required: true schema: type: string format: uuid foreignId: name: foreignId description: ID for the foreign element being manipulated. in: path required: true schema: type: string format: uuid schemas: favorite: type: object required: - id - user_id - foreign_key - foreign_model - created - modified properties: id: type: string format: uuid user_id: type: string format: uuid foreign_key: type: string format: uuid foreign_model: type: string enum: - Resource created: type: string format: date-time modified: type: string format: date-time header: type: object required: - id - status - servertime - action - message - url - code properties: id: type: string format: uuid status: type: string enum: - success - error servertime: type: integer example: 1720702619 action: type: string format: uuid message: type: string example: The operation was successful. url: type: string format: uri example: /auth/verify.json code: type: integer example: 200 securitySchemes: bearerHttpAuthentication: description: Bearer token using a JWT type: http scheme: Bearer bearerFormat: JWT gpgCookieAuthentication: description: Session-based authentication. Note that a CSRF token needs to be provided through a header named `X-CSRF-Token`. type: apiKey in: cookie name: passbolt_session