schnittstellen:swagger_file
Swagger File
Whats a Swagger File? It does sound quite Swagger.
As you can see by its category its related to APIs, Swagger is a tool for API documentation, so basically a tool to easily create API specifications.
It helps with structuring the specification so you can easily define endpoints, their possible/required inputs and responses and what those responses will look like, making it easy to build code to fit the needs of the API.
It looks something like this:
The syntax for it is yaml and looks like this:
This is a single endpoint
'/private/offers': post: summary: Create or "dry-save" offer for a policy with one or up to four premium(s). description: This action does not support idempotency. tags: - Offers requestBody: description: Product, insurance & customer data necessary to create an offer for a policy. required: true content: application/json: schema: $ref: '#/components/schemas/Offer' responses: '201': description: Successfully processed. The policy offer is now ready for download and payment or finalisation (depending on money collection of partner). content: application/json: schema: $ref: '#/components/schemas/OfferCreated' '204': description: Successfully verified (`dry_save` = `true`). The offer is now ready to be created (`dry_save` = `false`). '400': description: Bad request. content: application/json: schema: $ref: '#/components/schemas/BadRequest' '401': description: Authorization information is missing or invalid. content: application/json: schema: $ref: '#/components/schemas/Unauthorized' '403': description: Partner is not allowed to book this product & premium or some of the premiums exclude each other. content: application/json: schema: $ref: '#/components/schemas/Forbidden' '405': description: Method not allowed. content: application/json: schema: $ref: '#/components/schemas/MethodNotAllowed' '406': description: Not acceptable content: application/json: schema: $ref: '#/components/schemas/NotAcceptable' '415': description: Unsupported Media Type content: application/json: schema: $ref: '#/components/schemas/UnsupportedMediaType' '422': description: Unprocessable Entity content: application/json: schema: $ref: '#/components/schemas/UnprocessableEntity' '500': description: Unexpected error. content: application/json: schema: $ref: '#/components/schemas/InternalServerError'
It references this schema:
Offer: required: - offer properties: offer: type: object required: - premiums - customer_data - accepted_policy_conditions properties: premiums: type: array minItems: 1 maxItems: 4 items: $ref: '#/components/schemas/PremiumBookingData' customer_data: $ref: '#/components/schemas/CustomerData' accepted_policy_conditions: type: boolean enum: - true description: Whether the customer agrees to the policy conditions. Must be true. language: type: string minLength: 2 maxLength: 2 description: The language of the policy, defaults to "DE" for German. default: 'DE' enum: - DE - FR - EN example: FR collection_over: type: string maxLength: 20 description: The institution through which money is collected. Partners need to have the permission to set this. Defaults to PostFinance Checkout. default: 'POSTFINANCE' enum: - 'POSTFINANCE' - 'COLLECTION_ERV' - 'COLLECTION_PARTNER' example: 'COLLECTION_PARTNER' send_policy_email: type: boolean default: true example: true enum: - true description: Always send an e-mail with the policy PDF should be sent when the booking is completed (paid). Must be true. In test environment no actual e-mails are sent. dry_save: type: boolean default: false example: false enum: - false - true description: Whether a "dry-save" of the offer should be performed. Defaults to `false` (actual processing). send_offer_email: type: boolean default: false example: true enum: - false - true description: Whether an e-mail with the policy offer PDF should be sent when the offer is created. Defaults to `false`. In test environment no actual e-mails are sent. partner_reference: type: string pattern: '^[a-zA-Z0-9\.\-_]+$' minLength: 1 maxLength: 120 example: 'ABCDEF-1234567890' description: An optional partner reference which can be used to cancel a policy. tenant_url_code: type: string minLength: 1 maxLength: 120 example: 'TENANT_URL_CODE_01' description: An optional URL code that will be used to assign the offer of the policy to a given tenant. The authenticated Partner API user must be affiliated with the given tenant.
schnittstellen/swagger_file.txt · Last modified: by admin

