mirror of
https://github.com/rooyca/obsidian-api-request.git
synced 2026-07-22 07:50:27 +00:00
update(docs): req run repeatedly & notifications
This commit is contained in:
parent
324b68c077
commit
264e26c138
2 changed files with 43 additions and 11 deletions
13
README.md
13
README.md
|
|
@ -1,4 +1,4 @@
|
|||
# APIR - API Request
|
||||
# APIR - APIRequest
|
||||
|
||||
|
||||
[](https://github.com/rooyca/obsidian-api-request/releases/latest)
|
||||
|
|
@ -7,11 +7,7 @@
|
|||
|
||||

|
||||
|
||||
Obsidian plugin that allows you to make requests to API's and receive responses in code-blocks or store them in `localStorage`.
|
||||
|
||||
> [!IMPORTANT]
|
||||
>
|
||||
> JSON, TEXT, HTML and MARKDOWN responses supported
|
||||
[Obsidian](https://obsidian.md/) plugin that allows you to make requests to APIs or any other URL and display the response in a code-block.
|
||||
|
||||
## Installation
|
||||
|
||||
|
|
@ -31,7 +27,7 @@ There are two ways to use the plugin:
|
|||
|
||||
### With Code-blocks
|
||||
|
||||
To use it, create a code-block with the language set to `req`. Inside the code-block, you can specify `url`, `method`, `body`, `headers`, `format`, etc.
|
||||
To use it, create a code-block with the language set to `req`. Inside the code-block, you can specify `url`, `method`, `body`, `headers`, `format`, etc. [Check docs](https://rooyca.github.io/obsidian-api-request/codeblocks/).
|
||||
|
||||
```req
|
||||
url: https://api.chess.com/pub/player/hikaru/stats
|
||||
|
|
@ -109,6 +105,8 @@ To use the plugin, press `Ctrl+P` and search for `APIR`. There are two options:
|
|||
1. Show response in modal
|
||||
2. Paste response in current document (at current line)
|
||||
|
||||
[Check docs](https://rooyca.github.io/obsidian-api-request/settings/).
|
||||
|
||||
#### Settings
|
||||
|
||||
The plugin has a few settings that you can configure:
|
||||
|
|
@ -116,7 +114,6 @@ The plugin has a few settings that you can configure:
|
|||

|
||||
|
||||
- URL: The URL to send the request to.
|
||||
- Format Output: Just JSON blocks (for now).
|
||||
- Method: Choose between GET, POST, PUT & DELETE.
|
||||
- Body: The data to send with the request. Data should by in JSON format.
|
||||
- Headers: The header data to send with the request. Data should by in JSON format. (`{"Content-Type": "application/json", "Authorization": "Bearer TOKEN"}`)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ Flags are the way to specify the parameters of our request and also the format i
|
|||
| response-type | json |
|
||||
| req-id | req-general |
|
||||
| disabled | |
|
||||
| req-repeat | 1t@1s |
|
||||
| notify-if | |
|
||||
|
||||
### url
|
||||
|
||||
|
|
@ -28,7 +30,7 @@ url: https://jsonplaceholder.typicode.com/users/{{this.id}}
|
|||
```
|
||||
~~~
|
||||
|
||||
!!! info "Where `{{this.id}}` is a variable (`id`) defined in the frontmatter."
|
||||
!!! note "Where `{{this.id}}` is a variable (`id`) defined in the frontmatter."
|
||||
|
||||
|
||||
### method
|
||||
|
|
@ -59,7 +61,7 @@ body: {"title": {{this.title}}, "body": "bar", "userId": 1}
|
|||
```
|
||||
~~~
|
||||
|
||||
!!! info "Where `{{this.title}}` is a variable (`title`) defined in the frontmatter."
|
||||
!!! note "Where `{{this.title}}` is a variable (`title`) defined in the frontmatter."
|
||||
|
||||
### headers
|
||||
|
||||
|
|
@ -133,7 +135,7 @@ format: <h1>{}</h1> <p>{}</p>
|
|||
```
|
||||
~~~
|
||||
|
||||
!!! info "In this example, first `{}` will be replaced by the title, and second `{}` will be replaced by the body."
|
||||
!!! note "In this example, first `{}` will be replaced by the title, and second `{}` will be replaced by the body."
|
||||
|
||||
|
||||
### res-type
|
||||
|
|
@ -209,6 +211,39 @@ disabled
|
|||
```
|
||||
~~~
|
||||
|
||||
### req-repeat
|
||||
|
||||
!!! warning "This only works with JSON responses"
|
||||
|
||||
Specifies the number of times the request should be repeated and the interval between each repetition. The default value is `1t@1s` (read as `X time(s) every X second(s)`). Letters `t` and `s` are not mandatory.
|
||||
|
||||
|
||||
~~~markdown
|
||||
```req
|
||||
url: api.coincap.io/v2/rates/bitcoin
|
||||
req-repeat: 5@5
|
||||
```
|
||||
~~~
|
||||
|
||||
### notify-if
|
||||
|
||||
!!! warning "This only works with JSON responses"
|
||||
|
||||
Specifies the condition to trigger a notification. Can be used to monitor a specific value. The path syntax used to access nested objects varies from the `show` flag, here dots are used instead of arrows and not spaces are allowed in the path.
|
||||
|
||||
~~~markdown
|
||||
```req
|
||||
url: api.coincap.io/v2/rates/bitcoin
|
||||
req-repeat: 5@5
|
||||
notify-if: data.rateUsd < 69889
|
||||
```
|
||||
~~~
|
||||
|
||||
!!! note "In the example above, a notification will be triggered everytime the value of `data.rateUsd` is less than `69889`."
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue