Skip to content

Commit

Permalink
chore(docs): Add use-case for empty string baseUrl (#48)
Browse files Browse the repository at this point in the history
It was requested in #47 to add support to `.request()` for full URLs because [webooks](https://www.eventbrite.com/developer/v3/api_overview/webhooks/) returns full API urls. However instead of updating `.request()` a client can just set the `baseUrl` to empty string (`''`) when configuring the SDK object.

This adds docs and an example for future users.

Closes #47.
  • Loading branch information
benmvp authored and BenAtEventbrite committed Nov 15, 2018
1 parent 41e257a commit dce1204
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ This SDK interface closely mirors the [Eventbrite v3 REST API](https://www.event

## ToC

* [Including the package](#including-the-package)
* [Configuring a SDK object](#configuring-a-sdk-object)
* [`request()`](./request.md)
- [Including the package](#including-the-package)
- [Configuring a SDK object](#configuring-a-sdk-object)
- [`request()`](./request.md)

## Including the package

Expand Down Expand Up @@ -45,7 +45,18 @@ const sdk = eventbrite({token: 'OATH_TOKEN_HERE'});

You can configure the SDK object with the following properties:

* `token` - The Eventbrite [OAuth token](https://www.eventbrite.com/developer/v3/api_overview/authentication/#ebapi-getting-a-token)
* `baseUrl` - The base URL prepending to endpoints when making API requests (defaults to `'https://www.eventbriteapi.com/v3'`). So when using the `'/users/me/'` endpoint, a request would be made to `https://www.eventbriteapi.com/v3/users/me/`. _NOTE: You probably will not need to use this property._
- `token` - The Eventbrite [OAuth token](https://www.eventbrite.com/developer/v3/api_overview/authentication/#ebapi-getting-a-token)
- `baseUrl` - The base URL The base URL prepended to endpoints when making API requests (defaults to `'https://www.eventbriteapi.com/v3'`). When using the `'/users/me/'` endpoint, a request would be made to `https://www.eventbriteapi.com/v3/users/me/`. When using [webooks](https://www.eventbrite.com/developer/v3/api_overview/webhooks/), you will receive full API urls, so set the `baseUrl` to empty string (`''`).

```js
import eventbrite from 'eventbrite';

// Create configured Eventbrite SDK
// When all request endpoints will be full URLs
const sdk = eventbrite({
token: 'OATH_TOKEN_HERE',
baseUrl: '',
});
```

From then on, you can use `sdk` to make API requests.

0 comments on commit dce1204

Please sign in to comment.