Invoke Block

Use the invoke block to define operation's request message and

Syntax

  • Invoke keyword can be followed by one or two blocks, to set up request message and response steps

Usage

Only check response message

With Operation <http://example.com/vocab#CreateIssueOperation> {
    Invoke {
        Expect Status 201
    }
}

Setting request headers

PREFIX api: <http://example.app/>

With Operation api:GetImage {
    Invoke {
        Accept "image/*"
    } => {
        Expect Status 200
    }
}

Sending request body

Request body can be set in two ways. One is to provide the contents inline, delimited by triple backticks similarly to markdown.

The parser preserves all whitspace except leading a trailing. If whitespace is signinficant load the body from a file.

PREFIX api: <http://example.app/>

With Operation api:UpdateProfile {
    Invoke {
        ```
        {
            "op": "add",
            "s": "http://example.org/my/resource",
            "p": "http://example.org/ontology#title",
            "o": {
              "value": "New Title",
              "type": "http://www.w3.org/2001/XMLSchema#string"
            }
          }
        ```
    } => {
        Expect Status 204
    }
}

Second way is to reference a file whose contents will be sent.

PREFIX api: <http://example.app/>

With Operation api:SetProfilePicture {
    Invoke {
        Content-Type "image/png"

        <<< "./images/avatar.png"
    } => {
        Expect Status 204
    }
}
Last Updated: 7/28/2019, 4:22:30 PM