Overview

Transactions and steps

An APId configuration file consists of transactions which in turn consist of steps. Steps are the basic elements of the configuration. They specify how to make a request and then how to validate its response. Transactions bundle steps together to help you represent meaningful stories.

Variables

APId has variables that can be inplaced throughout your steps and transactions. Variables can be declared for the transaction or step scope or be global. They can also come from the environment, which can be handy for things like secrets and passwords, or from a response from your API. Most string values in the yaml config can contain templates ({{ }}).

Commands

Commands allow to execute shell commands (using your default $SHELL) and use the output inside the request. They can be used anywhere templates can. They use the {% %} delimiters. See commands for more details.

Skipping SSL verification

You can set skip_ssl_verify: true in the root level of the config to set APId to ignore all certificate errors.

Examples

version: 1
variables:
  api_url: "https://jsonplaceholder.typicode.com"
transactions:
  - id: "transaction-one"
    variables:
      title: "delectus aut autem"
      body: "quia et suscipit suscipit recusandae consequuntur expedita"
    steps:
      - id: "authenticate"
        request:
          method: POST
          endpoint: "{{ var.api_url }}/auth"
          headers:
            Authorization: "Basic {% echo -n $USERNAME:$PASSWORD | base64 %}"
        export:
          auth_header: "response.headers.X-APIDAUTH"

      - id: "get first todo"
        request:
          method: GET
          endpoint: "{{ var.api_url }}/todos/1"
          headers:
            X-APIDAUTH: "{{ authenticate.auth_header }}"
        expect:
          code: 200
          body:
            type: "json"
            exact: true
            content: |
              {
                "title": "{{ var.title }},
                "id": 1,
                "text": "{{ var.body }}",
                "completed": false
              }

Didn't find what you were looking for?

You can head over to our FAQ page