Skip to content

Commit

Permalink
Merge branch 'sebsel-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronpk committed Nov 11, 2017
2 parents 745c5d4 + 8e5163e commit 796defb
Show file tree
Hide file tree
Showing 10 changed files with 387 additions and 77 deletions.
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ XRay will parse content in the following formats. First the URL is checked again
* GitHub
* XKCD
* Hackernews
* Facebook (public events)

If the contents of the URL is XML or JSON, then XRay will parse the Atom, RSS or JSONFeed formats.

Expand Down Expand Up @@ -165,7 +166,7 @@ url=https://aaronparecki.com/2016/01/16/11/
&body=<html>....</html>
```

or for Twitter/GitHub where you might have JSON,
or for Twitter/GitHub/Facebook where you might have JSON,

```
POST /parse
Expand Down Expand Up @@ -199,25 +200,41 @@ url=https://aaronparecki.com/2016/01/16/11/
&token=12341234123412341234
```

### Twitter Authentication

XRay uses the Twitter API to fetch posts, and the Twitter API requires authentication. In order to keep XRay stateless, it is required that you pass in Twitter credentials to the parse call. You can register an application on the Twitter developer website, and generate an access token for your account without writing any code, and then use those credentials when making an API request to XRay.
### API Authentication

You should only send Twitter credentials when the URL you are trying to parse is a Twitter URL, so you'll want to check for whether the hostname is `twitter.com` before you include credentials in this call.
XRay uses the Twitter, Github and Facebook APIs to fetch posts, and those API require authentication. In order to keep XRay stateless, it is required that you pass in the credentials to the parse call.

You should only send the credentials when the URL you are trying to parse is a Twitter URL, a GitHub URL or a Facebook URL, so you'll want to check for whether the hostname is `twitter.com`, `github.com`, etc. before you include credentials in this call.


#### Twitter Authentication

XRay uses the Twitter API to fetch Twitter URLs. You can register an application on the Twitter developer website, and generate an access token for your account without writing any code, and then use those credentials when making an API request to XRay.

* `twitter_api_key` - Your application's API key
* `twitter_api_secret` - Your application's API secret
* `twitter_access_token` - Your Twitter access token
* `twitter_access_token_secret` - Your Twitter secret access token


### GitHub Authentication
#### GitHub Authentication

XRay uses the GitHub API to fetch GitHub URLs, which provides higher rate limits when used with authentication. You can pass a GitHub access token along with the request and XRay will use it when making requests to the API.

* `github_access_token` - A GitHub access token


#### Facebook Authentication

XRay uses the Facebook API to fetch Facebook URLs. You can create a Facebook App on Facebooks developer website.

* facebook_app_id - Your application's App ID
* facebook_app_secret - Your application's App Secret

At this moment, XRay is able to get it's own access token from those credentials.


### Error Response

```json
Expand Down Expand Up @@ -273,7 +290,7 @@ Possible errors are listed below:
}
```

#### Primary Data
#### Primary Data

The primary object on the page is returned in the `data` property. This will indicate the type of object (e.g. `entry`), and will contain the vocabulary's properties that it was able to parse from the page.

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"p3k/timezone": "*",
"p3k/http": "0.1.*",
"cebe/markdown": "1.1.*",
"miniflux/picofeed": "^0.1.37"
"miniflux/picofeed": "^0.1.37",
"facebook/graph-sdk": "^5.5"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit 796defb

Please sign in to comment.