Send and Test Requests
Every endpoint in DocStar is also a working request. You can send it from the editor, check the response, and fix the request before you publish it.
Open the request editor
- Open an endpoint from the sidebar of an API collection, or create one (see Document an API Endpoint).
- If the endpoint shows the reader layout, switch off the DOC toggle in the header to get back to the testing view.
Build the request
- Choose the method: GET, POST, PUT, PATCH or DELETE.
- Enter the URL. Type
{{to pick a variable from the selected environment. - Set up the request in the tabs below the URL:
| Tab | Use it to |
|---|---|
| Params | Add query params. Path variables such as :id in the URL get their own rows here. |
| Authorization | Pick No Auth, Basic Auth or OAuth 2.0. See Authorization. |
| Headers | Add headers such as Content-Type or Accept. |
| Body | Send none, raw (TEXT, JSON, XML, HTML or JavaScript), form-data or x-www-form-urlencoded. In form-data, set a row to File to upload a file. |
| Script | Run JavaScript before or after the request. See Scripts. |
Clear a row's checkbox to leave it out of the request without deleting it.
Tip: Paste a full curl command into the URL field. DocStar fills in the method, URL, headers and body for you.
Pick an environment
Use the environment dropdown in the tab bar (Select environment) to choose which set of variables to use. Variables such as {{BASE_URL}} or {{token}} are swapped in when you send. See Environments and Variables.
Send the request
Click Send, or press Ctrl+Enter (Cmd+Enter on Mac). While the request runs you can click Cancel.
The response appears below the request with its status, time and body. See Responses and Cookies.
How requests are sent
DocStar sends most requests through its own server, so you don't hit browser CORS limits. Requests to localhost or 127.0.0.1 go straight from your browser instead, so you can test an API running on your own machine.
Save your work
Press Ctrl+S (Cmd+S on Mac) or click Save. From the response you can also:
- Click Add to Sample Response to show this response in the docs.
- Click Save as Example Request to keep this version of the request under the endpoint.
Generate code
Click the code icon (</>) in the tab bar to open Generate Code Snippets. Pick a language, such as Shell, Node, Python, Java, Go or PHP, and copy the code for the current request.
Test from published docs
Readers of your published API reference can send requests too. They click TRY (or press Ctrl+Enter) on an endpoint page to see the live response. Share a public environment so they start with the right base URL and values.