Skip to content
Shortcut: /, ⌘K or Ctrl+K

polymorfa api

Make an authenticated request through the Polymorfa SDK.

Polymorfa CLI · CLI API requests

View as Markdown

polymorfa api

Make an authenticated request through the Polymorfa SDK.

Usage

polymorfa api ENDPOINT [flags]

Examples

polymorfa api /platform/projects --surface platform
polymorfa api /v1/campaigns --surface platform -X POST -f name=Launch -F dryRun=true -F audience[]=vip
polymorfa api /platform/customers --surface platform --paginate --jq '.data[].id'
polymorfa api /platform/customers --surface platform --paginate --slurp --jq 'map(.data | length) | add'
polymorfa api /platform/projects --surface platform --template '{{range .data}}{{.slug}}{{"\t"}}{{.name}}{{"\n"}}{{end}}'

Arguments

  • ENDPOINTrequired

    Relative API endpoint beginning with a slash.

Flags

  • -F, --field <value>takes a valuerepeatable

    Add a typed field using name=value: true, false, null and integers become JSON; @file or @- reads a file or stdin. Use name[sub]=v to nest and name[]=v to append.

  • -H, --header <value>takes a valuerepeatable

    Add a request header using name:value.

  • -i, --includeboolean

    Include response metadata in human output, including each page with --paginate --slurp.

  • --input <value>takes a value

    Read a complete JSON body from a file or standard input (-).

  • -q, --jq <value>takes a value

    Filter the response with a jq expression (embedded jq 1.8). Strings print without quotes and keep their whitespace.

  • --max-pages <value>takes a value

    Fail instead of fetching more than this many pages. Defaults to 100.

  • -X, --method <value>takes a value

    HTTP method.

    Allowed valuesGETPOSTPUTPATCHDELETEHEADOPTIONS
    Default GET
  • --paginateboolean

    Fetch every page by following page.nextCursor as the cursor query parameter (GET only).

  • -f, --raw-field <value>takes a valuerepeatable

    Add a string field using name=value.

  • --slurpboolean

    With --paginate, collect pages into one array before filtering or printing.

  • --surface <value>takes a valuerequired

    API credential surface.

    Allowed valuesmessagingplatform
  • -t, --template <value>takes a value

    Format the response with a Go-style template, such as {{range .data}}{{.id}}{{"\n"}}{{end}}.

Also accepts the global flags.