docs: update readme for bulk
This commit is contained in:
parent
de4b7ab484
commit
4e90be65eb
1 changed files with 30 additions and 3 deletions
29
README.md
29
README.md
|
|
@ -55,7 +55,7 @@ server: cloudflare
|
||||||
..other ephemeral headers..
|
..other ephemeral headers..
|
||||||
```
|
```
|
||||||
|
|
||||||
To create or update a custom short URl, send a `PUT` to the intended target URL:
|
To create or update a custom short URL, send a `PUT` to the intended target URL:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
erisa@Tuturu:~$ curl -X PUT -H "Authorization: mysecret" -H "URL: https://erisa.uk" https://erisa.link/mywebsite
|
erisa@Tuturu:~$ curl -X PUT -H "Authorization: mysecret" -H "URL: https://erisa.uk" https://erisa.link/mywebsite
|
||||||
|
|
@ -79,6 +79,29 @@ erisa@Tuturu:~$ curl -X DELETE -H "Authorization: mysecret" https://erisa.link/k
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can also bulk create multiple shortlinks at once by sending a `POST` to `/` with no `URL` header and with a JSON body instead:
|
||||||
|
|
||||||
|
```json
|
||||||
|
erisa@Tuturu:~$ curl -X POST -H "Authorization: mysecret" https://erisa.link/ \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{ "/short1": "https://example.com", "/mywebsite": "https://erisa.uk" }'
|
||||||
|
{
|
||||||
|
"message": "URLs created successfully",
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"key": "short1",
|
||||||
|
"shorturl": "https://erisa.link/short1",
|
||||||
|
"longurl": "https://example.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "mywebsite",
|
||||||
|
"shorturl": "http://erisa.link/mywebsite",
|
||||||
|
"longurl": "https://erisa.uk"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
It is a planned feature to be able to list all URLs via a `GET` on `/` with `Authorization`.
|
It is a planned feature to be able to list all URLs via a `GET` on `/` with `Authorization`.
|
||||||
|
|
||||||
For the time being you can view them from your Cloudflare Dashboard:
|
For the time being you can view them from your Cloudflare Dashboard:
|
||||||
|
|
@ -95,3 +118,7 @@ This code is relatively simple but still, if you find any security issues that c
|
||||||
If you don't have access to Workers KV you're welcome to test these issues on my live `erisa.link`, provided you don't send excessive (constant) requests or delete/modify any keys except ones created by you or the `/sample` key.
|
If you don't have access to Workers KV you're welcome to test these issues on my live `erisa.link`, provided you don't send excessive (constant) requests or delete/modify any keys except ones created by you or the `/sample` key.
|
||||||
|
|
||||||
If I don't respond to your email for whatever reason please feel free to publicly open an issue.
|
If I don't respond to your email for whatever reason please feel free to publicly open an issue.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue