Setting the method and URL
Choose a standard or custom HTTP method and build the URL and its query parameters.
Overview
The URL bar at the top of the request editor holds the request's method and URL. Query parameters can go straight into the URL, or in the Params tab, where you can turn each one on and off.
Any part of the URL and its parameters can contain variables, such as {{baseUrl}}/users/{{userId}}. Relay replaces them with their values when you send. For more information, see Using variables.
Choose a method
Click the method at the start of the URL bar and choose one of the standard methods: GET, POST, PUT, PATCH, DELETE, HEAD or OPTIONS. Below them, the menu lists the custom methods already used by your drafts and by the requests in the window's workspace.
New requests use GET. To start them with another method, open the Requests pane of Relay > Settings and choose a Default Method.
Use a custom method
You can send any method that HTTP allows, such as PROPFIND, PURGE or QUERY.
- Click the method in the URL bar and choose Custom….
- Enter the method's name. Relay changes it to uppercase as you type.
- Click Set.
A method can be up to 32 characters long and contain letters, digits and the characters !#$%&'*+-.^_`|~. Relay doesn't send CONNECT.
Send a body with the right method
GET, HEAD and TRACE requests can't have a body. While a request has a body, the method menu leaves those methods out. If you choose a body type for a GET, HEAD or TRACE request, Relay changes its method to POST. To use one of those methods again, set the body type to None in the Body tab.
Enter the URL
Click the URL field and enter or paste the URL. If you leave out the scheme, Relay adds https://, or http:// for a local host such as localhost, a .local name, or a loopback or private IP address.
To send the request from the URL field, press Return.
Add query parameters
- In the request editor, click Params, or press Command-2.
- Click Add Parameter.
- Enter the parameter's name and value.
Select or deselect the checkbox at the start of a row to turn the parameter on or off without deleting it. To delete it, click the Remove button (–) at the end of its row. The Params tab shows how many parameters are turned on.
When Relay sends the request, it adds the parameters that are turned on to the end of the URL's query, after any parameters you typed in the URL field, and percent-encodes their names and values. The Params tab and the URL field are separate: parameters you type in the URL don't appear in the Params tab. A row without a name isn't sent.
Change the request to a WebSocket request
When you enter a URL that starts with ws:// or wss://, the request becomes a WebSocket request. You can also click the method and choose WebSocket. To change it back, click the WSS badge where the method was and choose HTTP Request. To undo the change, choose Edit > Undo.
For more information, see Connecting to a WebSocket server.
See Also
- Adding headers: Send headers with a request and control which ones are included.
- Adding a request body: Send text, JSON, form fields or files with a request.
- Using variables: Insert values into requests with
{{name}}tokens and see where each value comes from. - Generating dynamic values: Fill requests with fresh IDs, timestamps and sample data each time they're sent.