Skip to content

Commit

Permalink
GitBook: [master] 3 pages and one asset modified
Browse files Browse the repository at this point in the history
  • Loading branch information
Imad authored and gitbook-bot committed Sep 20, 2019
1 parent c5783d7 commit 0599790
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 6 deletions.
Binary file added .gitbook/assets/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Table of contents

* [Introduction](README.md)
* [Registration](https://cacheful.app/register)

## API reference

* [Introduction](api-reference/introduction.md)
* [Projects](api-reference/projects.md)
* [Locations](api-reference/locations.md)
* [Sitemaps](api-reference/sitemaps.md)
Expand Down
47 changes: 47 additions & 0 deletions api-reference/introduction.md
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"
}
]
```

6 changes: 0 additions & 6 deletions api-reference/projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ This endpoint will provide all the projects you own.

{% api-method-spec %}
{% api-method-request %}
{% api-method-query-parameters %}
{% api-method-parameter name="Authorization" type="string" required=true %}
_Include your bearer token in the authorization header for every request!_
{% endapi-method-parameter %}
{% endapi-method-query-parameters %}
{% endapi-method-request %}

{% api-method-response %}
{% api-method-response-example httpCode=200 %}
Expand Down

0 comments on commit 0599790

Please sign in to comment.