PostcardsDocument APIs with executable example requests. Postcard formatEach Postcard (any file with the extension
Blank lines and comment lines are ignored while reading request metadata. The
first meaningful line contains the HTTP method and URL. A line beginning with
Comments may also follow request data when separated from it by whitespace:
Query parameters may instead remain in the request URL. Inline parameters are treated as already encoded and are left unchanged. Both styles can be combined:
Request bodiesFor methods such as
The first non-comment line after a blank line that is not another valid query parameter or header begins the body. This means blank lines can still separate request metadata. Everything from the beginning of the body to the end of the file is sent as authored, including indentation, blank lines, and text that looks like a Postcards comment. Bodies are raw text: Postcards does not infer a content type, serialize JSON,
or escape substituted variable values. Variables and secrets are resolved by
textual substitution, so values must be valid for the body format in which they
are used. Variables and contextsRequests may require context variables in URLs, friendly query values, header values, and bodies:
Variable names are case-sensitive and use letters, digits, and underscores,
starting with a letter or underscore. A request containing variables must use a
selected context; Variables embedded in the request URL are substituted as written before Fetch
normalizes the URL. Variables used in friendly Contexts are
The
When sending a request whose required secret has no stored value, Postcards asks for it using a masked input. The value is saved in VS Code's encrypted secret storage, scoped to the workspace folder, context, and variable name; it is not written to the repository or synchronized to other machines. Run Postcards: Forget Secret for Context to choose one stored secret to remove, or to remove all secrets for the selected context, and be prompted again when they are next needed. Secret-ness belongs to a context binding. For example, Postcards looks for Run Postcards: Select Context or use the Postcards status-bar item to choose a context. The selection is remembered for that workspace folder. Previewing and sending are blocked if a required variable is absent from the selected context. Context loading and request sending require a trusted workspace. Preview and send requestsRun Postcards: Preview Request from the Command Palette or choose
Preview Request directly above the request line. The parsed request appears
in a read-only Postcards Result editor beside the request file. Previewing
does not send a network request or retrieve and prompt for secret values;
declared secrets appear as Valid Send a requestChoose Send Request above a valid request or run Postcards: Send Request
from the Command Palette. Postcards sends the parsed method, URL, query
parameters, headers, and body, then displays the response status, headers, and
body in the read-only Postcards Result editor beside the request. The outgoing
request is shown above the response, preceded by the source filename and the
context used. It includes all authored headers and the default
Secret values are replaced with The request section shows the URL and headers from the normalized Fetch
|