-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GitBook: [master] 3 pages and one asset modified
- Loading branch information
1 parent
c5783d7
commit 0599790
Showing
4 changed files
with
49 additions
and
6 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
description: >- | ||
Learn how to use our API and build your own custom sitemaps workflow, just the | ||
way you like to. | ||
--- | ||
|
||
# Introduction | ||
|
||
## API Authentication | ||
|
||
{% hint style="info" %} | ||
**All authorization is done through a single API token.** You can generate and/or revoke an api token at any time. To manage your api tokens, log in to your account and navigate to your settings panel. You'll find the API tab in the left sidebar. Remember to include your bearer token in the **Authorization header** for every API request. | ||
{% endhint %} | ||
|
||
```javascript | ||
{ "Authorization": "Bearer: your-secure-bearer-token-here" } | ||
``` | ||
|
||
## Example with curl | ||
|
||
You can use `curl` to do API requests. Here's an example, including the required `Authorization` header. | ||
|
||
```bash | ||
API_TOKEN="your-api-token-here"; | ||
curl -XGET \ | ||
-H "Authorization: Bearer ${API_TOKEN}" \ # Authenticate with Bearer token | ||
https://sitemap.sh/api/projects > ./results.json | ||
``` | ||
|
||
{% hint style="info" %} | ||
Use `json_pp` to beautify JSON output from your command line. [Here's the manpage](http://manpages.ubuntu.com/manpages/disco/man1/json_pp.1.html). | ||
{% endhint %} | ||
|
||
#### Beautify JSON output | ||
|
||
```bash | ||
╰─$ echo '[{"key":"value"},{"key2": "value2"}]' | json_pp | ||
[ | ||
{ | ||
"key" : "value" | ||
}, | ||
{ | ||
"key2" : "value2" | ||
} | ||
] | ||
``` | ||
|
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