-
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64e62b9
commit edecf84
Showing
3 changed files
with
87 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,68 @@ pipx install posting | |
|
||
Python 3.11 or later is required. | ||
|
||
More installation methods (`brew`, etc) will be added soon. | ||
More installation methods (`brew`, etc) will be added soon. | ||
|
||
## A quick introduction | ||
|
||
This introduction will show you how to create a simple POST request to the [JSONPlaceholder](https://jsonplaceholder.typicode.com/) mock API to create a new user. It focuses on an efficient keyboard-driven workflow, but you can also use the mouse if you prefer. | ||
|
||
### Collections and requests | ||
|
||
A *collection* is simply a directory which may contain requests saved by Posting. | ||
|
||
If you launch Posting without specifying a collection, any requests you create will be saved in the "default" collection. | ||
This is a directory reserved by Posting on your filesystem, and unrelated to the directory you launched Posting from. | ||
|
||
This is fine for quick throwaway requests, but you'll probably want to create a new collection for each project you work on so that you can check it into version control. | ||
|
||
To create a new collection, simply create a new directory and pass it into Posting: | ||
|
||
```bash | ||
mkdir my-collection | ||
posting --collection my-collection | ||
``` | ||
|
||
Now, any requests you create will be saved in the `my-collection` directory as simple YAML files with the `.posting.yaml` extension. | ||
|
||
### Creating a request | ||
|
||
When you launch Posting, no request is open. | ||
|
||
You can immediately start creating a request, and then save it to disk with ++ctrl+s++. | ||
Let's do just that. | ||
We'll create a simple POST request to the [JSONPlaceholder](https://jsonplaceholder.typicode.com/) mock API to create a new user. | ||
|
||
Press ++ctrl+t++ to open the request method dropdown, then press ++p++ to quickly select the `POST` method. | ||
|
||
Press ++tab++ to move focus to the next widget, which is the URL bar. The URL bar can also be focused with ++ctrl+l++. Type `https://jsonplaceholder.typicode.com/users` into the URL bar. | ||
|
||
### Adding a JSON body | ||
|
||
Press ++ctrl+o++ to enter "jump mode", then press ++w++ to quickly jump to the "Body" tab. | ||
|
||
Press ++j++ (or ++down++) to move the cursor down to the dropdown. Press ++enter++ to open it, and select the option `Raw (json, text, etc.)`. | ||
|
||
Move down to the text area below using ++j++ (or ++down++), and type (or paste) the JSON below. | ||
|
||
```json | ||
{ | ||
"name": "John Doe", | ||
"username": "johndoe", | ||
"email": "[email protected]" | ||
} | ||
``` | ||
|
||
### Viewing keyboard shortcuts | ||
|
||
Now is probably a good time to note that you can see the full list of keyboard shortcuts for the focused widget by pressing ++f1++. The text area widget in particular has a lot of useful shortcuts and supports things like undo/redo. | ||
|
||
|
||
### Sending the request | ||
|
||
Press ++ctrl+j++ to send the request. This shortcut works globally. | ||
|
||
### Saving the request | ||
|
||
Finally, press ++ctrl+s++ to save the request to disk. | ||
Fill out the form on the modal that appears, and press ++enter++ or ++ctrl+n++ to write the request to disk. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters