Open source news API for quants.
All requests to our API require authentication. The Bearer token must be provided as part of header for every request, using the authorisation Bearer variable. This token is retrieved after a successful login with an e-mail and password using Basic Authentication.
POST /auth/basic
| Name | Type | Description |
|---|---|---|
| String | User's Email address |
|
| password | String | User's password |
Curl Usage:
curl http://api.restfulnews.com/auth -XPOST \
-H 'Content-Type:application/json' \
-d '{"email":"<email>","password":"<password>"}' \
Success-Response:
HTTP/1.1 200 OK
{
"token":"<bearer token>",
"user": {
"id":"<user_id token>",
"name":"<name>",
"picture":"<display picture link>",
"role":"<role>",
"email":"<email>",
"createdAt":"<created at date>"
}
}
All requests to our API require authentication. The Bearer token must be provided as part of header for every request, using the authorisation Bearer variable. This token is retrieved after a successful login with using Google Authentication.
POST /auth/google
| Name | Type | Description |
|---|---|---|
| Bearer | String | Google user accessToken. |
Curl Usage:
curl http://api.restfulnews.com/auth -XPOST \
-H 'Content-Type:application/json' \
-d '{"token":"<Google OAuth Token>"}' \
--oauth2-bearer "<bearer token>"
Success-Response:
HTTP/1.1 200 OK
{
"token":"<bearer token>",
"user": {
"id":"<user_id token>",
"name":"<name>",
"picture":"<display picture link>",
"role":"<role>",
"email":"<email>",
"createdAt":"<created at date>"
}
}
Creates a News object.
POST /news
| Name | Type | Description |
|---|---|---|
| Bearer | String | user access token. |
| Name | Type | Description |
|---|---|---|
| title | String | Title of the news article. |
| abstract | String | Abstract of the news article. |
| url | String | optional URL to the news article. |
| source | String | optional URL Source to the news article. |
| thumbnail | String | optional URL Source to the news article thumbnail. |
| publishedAt | Date.toISOString | optional Pulished date of the news article. (format: YYYY-MM-DDTHH:mm:ss.sssZ) |
Curl Usage:
curl --request POST \
--url http://api.restfulnews.com/news \
--header 'authorization: Bearer <bearer token>' \
--header 'content-type: application/json' \
--data '{"title": "<title>", "publishedAt": "<published at date>", \
"fingerprint": "<fingerprint id>", "url": "<url>", "abstract": "<abstract>", \
"thumbnail": "<thumbnail link>", "source": "<source>"}'
{
"id": "<news article id>",
"createdAt": "<created at date>",
"updatedAt": "<updated at date>",
"url": "<url>",
"title": "<title>",
"source": "<source>",
"abstract": "<abstract>",
"thumbnail": "<thumbnail link>"
}
Deletes an existing News object.
DELETE /news/:id
| Name | Type | Description |
|---|---|---|
| Bearer | String | admin access token. |
Curl Usage:
curl --request DELETE \
--url http://api.restfulnews.com/news/<news article id> \
--header 'authorization: Bearer <bearer token>' \
--header 'content-type: application/json'
Retrieves a list of News objects.
GET /news
| Name | Type | Description |
|---|---|---|
| Bearer | String | admin access token. |
| Name | Type | Description |
|---|---|---|
| q | String | optional Query to search. |
| page | Number | optional Page number. |
| limit | Number | optional Amount of returned items. |
| sort | String[] | optional Order of returned items. |
| fields | String[] | optional Fields to be returned. |
Curl Usage:
curl --request GET \
--url http://api.restfulnews.com/news \
--header 'authorization: Bearer <bearer token>' \
--header 'content-type: application/json'
[
{
"id": "<news article id>",
"createdAt": "<created at date>",
"updatedAt": "<updated at date>",
"url": "<url>",
"title": "<title>",
"source": "<source>",
"abstract": "<abstract>",
"thumbnail": "<thumbnail link>"
},
...
]
Updates an existing News object with new information.
PUT /news/:id
| Name | Type | Description |
|---|---|---|
| Bearer | String | user access token. |
| Name | Type | Description |
|---|---|---|
| title | String | Title of the news article. |
| abstract | String | Abstract of the news article. |
| url | String | optional URL to the news article. |
| source | String | optional URL Source to the news article. |
| thumbnail | String | optional URL Source to the news article thumbnail. |
Curl Usage:
curl --request PUT \
--url http://api.restfulnews.com/news/<news article id> \
--header 'authorization: Bearer <bearer token>' \
--header 'content-type: application/json' \
--data '{"title":"<title>", "url":"<url", "source":"<source>", \
"abstract":"<abstract>", "thumbnail":"<thumbnail>"}'
Success-Response:
HTTP/1.1 200 OK
{
"id": "<news article id>",
"createdAt": "<created at date>",
"updatedAt": "<updated at date>",
"url": "<url>",
"title": "<title>",
"source": "<source>",
"abstract": "<abstract>",
"thumbnail": "<thumbnail link>"
}
Search for news articles from our news sources based which can be filtered by Topic, Company, Pulished Date.
GET /search
| Name | Type | Description |
|---|---|---|
| Bearer | String | user access token. |
| Name | Type | Description |
|---|---|---|
| topics | String | News topics split separated by a comma(,). |
| companyids | String | List of company id's separated by a comma(,). |
| start_date | Date.toISOString | optional Pulished date interval start. (format: YYYY-MM-DDTHH:mm:ss.sssZ) |
| end_date | Date.toISOString | optional Pulished date interval end. (format: YYYY-MM-DDTHH:mm:ss.sssZ) |
| limit | Integer | optional Maximum news articles to display per page. |
| page | Integer | optional Page number of results. |
Curl Usage:
curl --request GET \
--url http://api.restfulnews.com/search?topics=<topics>&start_date=<iso_time>&end_date=<iso_time>&companyids=<list of company id's> \
--header 'authorization: Bearer <bearer token>' \
--header 'content-type: application/json' \
[
{
"title": "<title>",
"publishedAt": "<published at date>",
"fingerprint": "<fingerprint id>",
"url": "<url>",
"abstract": "<abstract>",
"thumbnail": "<thumbnail>",
"source": "<source>"
},
...
}
]
Note: the `fingerprint` property is used to distinguish news articles, and is
generated from a hash of the news content.
Creates a user with the information provided in the parameters.
POST /users
| Name | Type | Description |
|---|---|---|
| String | User's email. |
|
| password | String | User's password. |
| name | String | User's name. |
| picture | String | optional User's picture. |
| role | String | optional User's role. |
Curl Usage:
curl --request POST --url http://api.restfulnews.com/users \
--header 'content-type: application/json' \
--data '{ "email": "<email>", "password": "<password>", \
"name": "<name>", "picture": "<picture link>"}'
Success-Response:
HTTP/1.1 200 OK
{
"token": <"bearer token">,
"user":
{
"id": "<user id>",
"name": "<name>",
"picture": "<picture link>",
"role": "<role>",
"email": "<email>",
"createdAt" : "<created at date>"
}
}
Deletes an existing user with the specified User ID.
DELETE /users/:id
| Name | Type | Description |
|---|---|---|
| Bearer | String | User access_token. |
Curl Usage:
curl --request DELETE \
--url 'http://api.restfulnews.com/users/<user_id>' \
--header 'authorization: Bearer <bearer token>' \
--header 'content-type: application/json'
Checks if a user exists with the specified email.
POST /email/:email
Curl Usage:
curl --request POST \
--url http://api.restfulnews.com/users/<email> \
--header 'authorization: Bearer <bearer token>' \
--header 'content-type: application/json'
Gets the current user who is logged in.
GET /users/me
| Name | Type | Description |
|---|---|---|
| Bearer | String | User access_token. |
Curl Usage:
curl --request GET \
--url http://api.restfulnews.com/users/me \
--header 'authorization: Bearer <Bearer Token>' \
--header 'content-type: application/json'
Success-Response:
HTTP/1.1 200 OK
{
"id":"<user id>",
"name":"<name>",
"picture":"<picture link>",
"role":"<role>",
"email":"<email>",
"createdAt":"<created at date>"
}
Retrieves a user's data when given the User ID.
GET /users/:id
Curl Usage:
curl --request GET --url http://api.restfulnews.com/users/<user id> \
--header 'authorization: Bearer <bearer token>' \
--header 'content-type: application/json'
Success-Response:
HTTP/1.1 200 OK
{
"id": "<user id>",
"name": "<name>",
"picture": "<picture link>",
"role": "<role>"
}
Gets a list of all users.
GET /users
| Name | Type | Description |
|---|---|---|
| Bearer | String | User access_token. |
| Name | Type | Description |
|---|---|---|
| q | String | optional Query to search. |
| page | Number | optional Page number. |
| limit | Number | optional Amount of returned items. |
| sort | String[] | optional Order of returned items. |
| fields | String[] | optional Fields to be returned. |
Curl Usage:
curl --request GET \
--url http://api.restfulnews.com/users \
--header 'authorization: Bearer <bearer token>' \
--header 'content-type: application/json'
Success-Response:
HTTP/1.1 200 OK
[
{
"id": "<user id>",
"name": "<name>",
"picture": "<picture>",
"role": "<role>",
"email": "<email>",
"createdAt": "<created at date>"
},
...
]
Sends a password reset code to the specified E-mail address.
GET /users/reset-code
| Name | Type | Description |
|---|---|---|
| Object | Email address to receive the password reset token. |
Updates an existing User's password.
PUT /users/:id/password
| Name | Type | Description |
|---|---|---|
| Authorization | String | Basic authorization with email and password. |
| Name | Type | Description |
|---|---|---|
| password | String | User's new password. |
Curl Usage:
curl --request PUT \
--url http://api.restfulnews.com/users/<user_id>/password \
--header 'authorization: Bearer <Bearer Token>' \
--header 'content-type: application/json' \
--data '{"password":"<new password>}'
Success-Response:
HTTP/1.1 200 OK
{
"id": "<user id>",
"name": "<name>",
"picture": "<picture link>",
"role": "<role>",
"email": "<email>",
"createdAt": "<created at date>"
}
POST /users/password/
| Name | Type | Description |
|---|---|---|
| String | Email address |
|
| code | String | Code |
Updates an existing User's information based on the parameters entered.
PUT /users/:id
| Name | Type | Description |
|---|---|---|
| Bearer | String | User access_token. |
| Name | Type | Description |
|---|---|---|
| name | String | optional User's name. |
| picture | String | optional User's picture. |
Curl Usage:
curl --request PUT \
--url http://api.restfulnews.com/users/<user_id>/update \
--header 'authorization: Bearer <Bearer Token>' \
--header 'content-type: application/json' \
--data '{"name": "<name>", "picture": "<picture link>"}'
Success-Response:
HTTP/1.1 200 OK
{
"id": "<user id>",
"name": "<name>",
"picture": "<picture link>",
"role": "<role>",
"email": "<email>",
"createdAt": "<created at date>"
}