HTTP Request Body
Overview
The Body tab in Martini's HTTP Request Editor is where you define the payload sent with an HTTP request.
Select a body type from the Body Type dropdown, then Martini configures the correct input format and automatically updates the Content-Type header.
This keeps your request configuration consistent and removes the need to manage headers manually.
What You Will Learn
- How to select and configure a body type for an HTTP request
- The difference between each supported body type and when to use each
- How to use variables in a request body
When To Use This
Use this when you need to:
- Send a payload with a
POST,PUT, orPATCHrequest - Submit form data or file uploads via
multipart/form-dataorx-www-form-urlencoded - Make queries or mutations to a GraphQL API endpoint
- Send structured data such as JSON, XML, or YAML to an API
- Attach a raw binary file as the entire request body
Prerequisites
- Martini Designer installed and running
- At least one HTTP request created and opened in the HTTP Request Editor
Selecting a Request Body Type
The Body tab is the central location for configuring what data gets sent with your HTTP request. Choosing the right body type ensures the server receives and interprets your payload correctly.
Getting Started with Request Body Configuration
To set the body for an HTTP request:
- Open the Body tab in the HTTP Request Editor.
- Select a body type from the Body Type dropdown.
- Enter or configure the payload using the fields or editor that appear.
Expected result: The Body tab updates to show the input controls for the selected body type, and the Content-Type header in the Headers tab is updated automatically.
Supported Body Types Reference
The following body types are available in Martini's HTTP Client.
Each type sets a corresponding Content-Type header automatically when selected.
| Body Type | Content-Type Header | Use Case |
|---|---|---|
| None | (not set) | Requests that don't require a body (GET, HEAD) |
| form-data | multipart/form-data |
Uploading files or submitting mixed text/file fields |
| x-www-form-urlencoded | application/x-www-form-urlencoded |
Submitting simple key-value text fields |
| Binary | application/octet-stream |
Sending a raw file as the full request body |
| GraphQL | application/json |
Making queries and mutations to GraphQL APIs |
| Plain Text | text/plain |
Sending unstructured text or markup content |
| JSON | application/json |
Sending JSON-formatted payloads |
| XML | application/xml |
Sending XML-formatted payloads |
| YAML | application/x-yaml |
Sending YAML-formatted payloads |
Form-Based Body Types
Form-based body types let you send key-value data as request payloads.
Martini supports the following:
- form-data — for text and file fields
- x-www-form-urlencoded — for text-only fields (URL-encoded)
Configuring a Form-Based Body
To add an entry:
- Select either form-data or x-www-form-urlencoded from the Body Type dropdown.
- Click the Add button in the Body toolbar, or press + .
- Fill in the fields:
- Name — The field name of this entry
- Type — Choose
TextorFile(for form-data only) - Value — The value to send
- Description — An optional note for your reference; not sent with the request
Expected result: A new row appears in the table and is included in the request body when sent.
To remove one or more entries:
- Select the rows you want to remove.
- Click the Delete button in the Body toolbar, or press .
Expected result: The selected entries are removed and no longer included in the request body.
To temporarily exclude an entry without deleting it:
- Uncheck the checkbox beside an entry.
Expected result: The entry remains visible but is not sent with the request.
Binary Body Type
The Binary body type sends the entire contents of a single file as the raw request body. Use this when an API endpoint expects a raw file upload rather than a multipart or form-encoded payload.
Configuring a Binary Body
To attach a file as a body:
- Select Binary from the Body Type dropdown.
- Click the Browse button.
- Select the file you want to send.
Expected result: The selected file name is displayed, and the full file contents are sent as the raw request body when the request is executed.
GraphQL Body Type
The GraphQL body type provides a pair of editors for constructing GraphQL operations. The request is sent as a JSON payload containing the query string and any associated variables.
Configuring a GraphQL Body
To configure a GraphQL request body:
- Select GraphQL from the Body Type dropdown.
- In the Query Editor, write your GraphQL query or mutation.
- In the Variables Editor, define any variables referenced in your query as a JSON object.
Expected result: The query and variables are combined into a single JSON payload and sent to the GraphQL endpoint when the request is executed.
Example — Query with variables:
Query Editor:
1 2 3 4 5 6 | |
Variables Editor:
1 2 3 | |
Structured and Text Body Types
Martini supports four body types for sending text-based payloads: Plain Text, JSON, XML, and YAML. Each provides a code editor where you enter your content directly, with syntax highlighting to help you identify formatting errors before sending the request.
Configuring a Plain Text Body
The Plain Text body type is an open-format editor for content that does not require structured markup. Use it for raw text payloads, human-readable messages, or formats not covered by the other body types.
To configure a plain text body:
- Select Plain Text from the Body Type dropdown.
- Enter your text content directly in the editor.
Expected result: The plain text content is sent with a Content-Type: text/plain header when the request is executed.
Configuring JSON, XML, and YAML Bodies
JSON, XML, and YAML bodies use the same process: select the body type, then enter your structured content in the provided editor.
To configure a structured body:
- Select JSON, XML, or YAML from the Body Type dropdown.
- Enter your content in the code editor.
Expected result: The editor applies syntax highlighting for the selected format. The content is sent as-is when the request is executed.
JSON example:
1 2 3 4 | |
XML example:
1 2 3 4 | |
YAML example:
1 2 | |
Using Variables in Request Bodies
You can reference variables in a request body using the [[variableName]] syntax.
Martini substitutes each placeholder with the corresponding variable value when the request is sent.
Variables are supported in all body types that accept text input. They are not supported in the Binary body type, which sends a file directly without substitution.
See Managing Variables in Martini's HTTP Client to define variables before using them in a request body.
Variables in Form-Based Bodies
In form-data and x-www-form-urlencoded bodies, you can use variables in the Name and Value fields of any entry. You can also concatenate a variable with a static string.
Example — Using a variable in the Name field:
| Name | Value |
|---|---|
[[environment]]_webhook_url |
https://hooks.example.com/notify |
[[region]]_cost_center |
CC-4800 |
Example — Using a variable as an entry value:
| Name | Value |
|---|---|
tenant_id |
[[tenantId]] |
notes |
Submitted on behalf of [[department]], [[region]] office |
Variables in GraphQL Bodies
In GraphQL bodies, you can use variables in both the Query Editor and the Variables Editor.
Example — Using a variable in the Variables Editor:
Variables Editor:
1 2 3 4 | |
Variables in Structured and Text Body Types
In JSON, XML, YAML, and Plain Text bodies, embed variables directly within the editor content. Variables can be used in both field names and field values.
JSON example:
1 2 3 4 5 | |
XML example:
1 2 3 4 5 | |
YAML example:
1 2 3 | |
Plain Text example:
1 2 3 | |
Troubleshooting Request Body Issues
| Problem | Detection | Cause | Fix |
|---|---|---|---|
| form-data entry not included in the request | Entry row is present but data is missing from the server's received payload | Entry checkbox is unchecked | Check the checkbox beside the entry name to re-enable it |
| GraphQL request returns a syntax error | Response body contains a GraphQL error message | The query in the Query Editor contains a syntax error, or variable names do not match | Validate the query syntax; confirm that variable names used in the query match the keys defined in the Variables Editor |
| Binary upload rejected with a size error | Server returns 413 Payload Too Large |
The selected file exceeds the server's maximum allowed body size | Use a smaller file, or adjust the maximum body size limits configured on the server side |
Helpful Resources
- HTTP Request Editor Overview - Overview of all tabs available in the HTTP Request Editor
- HTTP Request Headers - Manage and customize request headers, including overriding the
Content-Typeset by the body type - HTTP Request Authentication - Configure authentication schemes for HTTP requests
- Creating HTTP Requests - Create, save, and manage HTTP requests in the HTTP Client
- HTTP Client Overview - Summary of all features available in Martini's HTTP Client
- Managing Variables - Define and manage variables to use as dynamic placeholders in your requests
- Community Q&A: Martini Community Have a question? Post or search it here.