Review Fuel #internal API Documentation
Introduction

Introduction

Request Example

$ curl -X POST / -H "Content-type: application/json" / -H "X-ReviewFuel-Key: 2B3A18612CE9F227AF35A94B52983" / -H "X-ReviewFuel-Token: M9N0iOopesEbi7TnzU7gmcgwg3gWLNbFBhJz3GbVuPgNRKPW9zGo8A2ssuAcxX7o" / -d ' { [JSON Body]... }' https://user.reviewfuel.com:9000/resource

Invalid Key/Token Response

HTTP/1.1 200 OK Content-Type:application/json;charset=UTF-8 { "errorid":0, "errortext":"API Key and Token are not valid for this request." }

This documentation will keep track of the Review Fuel APIs.

The Review Fuel APIs are built using REST principles which ensures predictable URLs and a small number of objects that can be returned by each service. This API follows HTTP rules, enabling a wide range of HTTP clients can be used to interact with the API.

Every resource is exposed as a URL. The URL of each resource will be listed in this document.

Each resource will have an API Key and a Token for authentication purposes, and these must be passed in to each API key. These are taken from the custom HTTP headers X-ReviewFuel-Key and X-ReviewFuel-Token

Objects

The API revolves around a number of JSON objects that are either submitted or returned to and from the API end points.

This section will describe those objects.

User Object

JSON User Object

Content-Type:application/json;charset=UTF-8 { "id": 0, "email": "someuser@someurl.net", "password": "!123SomeLongPassword321!", "name": "Mike Smith", "adminUser": 0, "clientUser": 1, "sessionToken": "", "sessionExpiry": 0 }

Most calls to the User Service will both require and return a User Object. The User Object contains everything you, or the system, wants to know about the user. This includes:

Things To Note

Password Object

JSON Password Object

Content-Type:application/json;charset=UTF-8 { "id": 101, "oldPassword": "!123SomeLongPassword321!", "newPassword": "321!SomeLongPassword!123", "sessionToken": "95d46ac6-2117-4f27-8807-22a555586c5a" }

All calls to the User Service password reset endpoint will require a Password object and return a User Object. Everything is mandatory in the Password object

Things To Note

User Service

User Service API Endpoint

https://user.reviewfuel.com:9000

The User Service takes care of user actions. These include User creation and updating, logging in, session validation, and password reset

The User Service, generall speaking, performs operations with the User Object. This object is passed in with the required values depending on the operation

Create User

Request Example

$ curl -X POST / -H "Content-type: application/json" / -H "X-ReviewFuel-Key: 2B3A18612CE9F227AF35A94B52983" / -H "X-ReviewFuel-Token: M9N0iOopesEbi7TnzU7gmcgwg3gWLNbFBhJz3GbVuPgNRKPW9zGo8A2ssuAcxX7o" / -d ' { "id":0, "email":"newuser@whatevers.com", "password":"somenicelongpassword", "name":"New User", "adminUser":0, "clientUser":1, "sessionToken":"", "sessionExpiry":0 }' https://user.reviewfuel.com:9000/user

Response Example

HTTP/1.1 200 OK Content-Type:application/json;charset=UTF-8 { "id":101, "email":"newuser@whatevers.com", "password":"", "name":"New User", "adminUser":0, "clientUser":1, "sessionToken":"", "sessionExpiry":0 } HTTP/1.1 200 OK Content-Type:application/json;charset=UTF-8 { "errorid":1, "errortext":"Cannot create a user account. This email address already exists in our system." }

Creating a User is done by POSTing the User object to the /user endpoint.

When creating a new user, the User Object must contain the values mandated below.

Value Requirements
id Not Required, but must be included in the submitted JSON. Set to 0
email Required.
password Required.
Name Required.
adminUser Required. 1 or 0.
clientUser Required. 1 or 0.
sessionToken Not Required, but must be included in the submitted JSON. Set to ""
sessionExpiry Not Required, but must be included in the submitted JSON. Set to 0

Things To Note

Possible Errors

Update User

Request Example

$ curl -X PUT / -H "Content-type: application/json" / -H "X-ReviewFuel-Key: 2B3A18612CE9F227AF35A94B52983" / -H "X-ReviewFuel-Token: M9N0iOopesEbi7TnzU7gmcgwg3gWLNbFBhJz3GbVuPgNRKPW9zGo8A2ssuAcxX7o" / -d ' { "id":101, "email":"newuser@whatevers.com", "password":"somenicelongpassword", "name":"New Name", "adminUser":1, "clientUser":0, "sessionToken":"95d46ac6-2117-4f27-8807-22a555586c5a", "sessionExpiry":1010101010 }' https://user.reviewfuel.com:9000/user

Response Example

HTTP/1.1 200 OK Content-Type:application/json;charset=UTF-8 { "id":101, "email":"newuser@whatevers.com", "password":"", "name":"New Name", "adminUser":1, "clientUser":0, "sessionToken":"95d46ac6-2117-4f27-8807-22a555586c5a", "sessionExpiry":1010101010 } HTTP/1.1 200 OK Content-Type:application/json;charset=UTF-8 { "errorid":21, "errortext":"Cannot update a user account. Failed to retrieve session data." }

Updating a User is done by PUTing the modified User object to the /user endpoint.

When updating a user account, the User Object must contain the values mandated below.

Value Requirements
id Required. This will validate the user against their session.
email Required.
password Required.
Name Required.
adminUser Required. 1 or 0.
clientUser Required. 1 or 0.
sessionToken Required. A User must be logged in in order to update their details.
sessionExpiry Not Required, but must be included in the submitted JSON. Set to 0

Things To Note

Possible Errors

Login

Request Example

$ curl -X POST / -H "Content-type: application/json" / -H "X-ReviewFuel-Key: 2B3A18612CE9F227AF35A94B52983" / -H "X-ReviewFuel-Token: M9N0iOopesEbi7TnzU7gmcgwg3gWLNbFBhJz3GbVuPgNRKPW9zGo8A2ssuAcxX7o" / -d ' { "id":0, "email":"newuser@whatevers.com", "password":"somenicelongpassword", "name":"", "adminUser":0, "clientUser":0, "sessionToken":"", "sessionExpiry":0 }' https://user.reviewfuel.com:9000/login

Response Example

HTTP/1.1 200 OK Content-Type:application/json;charset=UTF-8 { "id":101, "email":"newuser@whatevers.com", "password":"", "name":"New Name", "adminUser":1, "clientUser":0, "sessionToken":"95d46ac6-2117-4f27-8807-22a555586c5a", "sessionExpiry":1010101010 } HTTP/1.1 200 OK Content-Type:application/json;charset=UTF-8 { "errorid":100, "errortext":"No Password Provided. No Email Provided" }

Updating a User is done by POSTing the modified User object to the /login endpoint.

When logging a user in, the User Object must contain the values mandated below.

Value Requirements
id Not Required, but must be included in the submitted JSON. Set to 0
email Required.
password Required.
Name Not Required, but must be included in the submitted JSON. Set to ""
adminUser Not Required, but must be included in the submitted JSON. Set to 0
clientUser Not Required, but must be included in the submitted JSON. Set to 0.
sessionToken Not Required, but must be included in the submitted JSON. Set to ""
sessionExpiry Not Required, but must be included in the submitted JSON. Set to 0

Things To Note

Possible Errors

Password Reset

Request Example

$ curl -X POST / -H "Content-type: application/json" / -H "X-ReviewFuel-Key: 2B3A18612CE9F227AF35A94B52983" / -H "X-ReviewFuel-Token: M9N0iOopesEbi7TnzU7gmcgwg3gWLNbFBhJz3GbVuPgNRKPW9zGo8A2ssuAcxX7o" / -d ' { "id": 101, "oldPassword": "!123SomeLongPassword321!", "password": "321!SomeLongPassword!123", "sessionToken": "95d46ac6-2117-4f27-8807-22a555586c5a" }' https://user.reviewfuel.com:9000/passwordreset

Response Example

HTTP/1.1 200 OK Content-Type:application/json;charset=UTF-8 { "id":101, "email":"newuser@whatevers.com", "password":"", "name":"New Name", "adminUser":1, "clientUser":0, "sessionToken":"95d46ac6-2117-4f27-8807-22a555586c5a", "sessionExpiry":1010101010 } HTTP/1.1 200 OK Content-Type:application/json;charset=UTF-8 { "errorid":21, "errortext":"Cannot reset password. Failed to retrieve session data" }

Updating a users Password is done by POSTing the modified Password object to the /passwordreset endpoint.

When resetting a users password, the Password Object must contain the values mandated below.

Value Requirements
id Required to make sure the password matces the right user
oldPassword Required to make sure the user is resetting their own password
newPassword Required. This will be the users new password
sessionToken Required to make sure the user is logged in while resetting their password

Things To Note

Possible Errors

Validate Session

Request Example

$ curl -X POST / -H "Content-type: application/json" / -H "X-ReviewFuel-Key: 2B3A18612CE9F227AF35A94B52983" / -H "X-ReviewFuel-Token: M9N0iOopesEbi7TnzU7gmcgwg3gWLNbFBhJz3GbVuPgNRKPW9zGo8A2ssuAcxX7o" / -d ' { "id":0, "email":"", "password":"", "name":"", "adminUser":0, "clientUser":0, "sessionToken":"95d46ac6-2117-4f27-8807-22a555586c5a", "sessionExpiry":0 }' https://user.reviewfuel.com:9000/validatesession

Response Example

HTTP/1.1 200 OK Content-Type:application/json;charset=UTF-8 { "id":101, "email":"newuser@whatevers.com", "password":"", "name":"New Name", "adminUser":1, "clientUser":0, "sessionToken":"95d46ac6-2117-4f27-8807-22a555586c5a", "sessionExpiry":1010101010 } HTTP/1.1 200 OK Content-Type:application/json;charset=UTF-8 { "errorid":100, "errortext":"No Session Token was supplied" }

Getting a valid User from their session id (cookie login) is done by POSTing the modified User object to the /validatesession endpoint.

When validating a session, the User Object must contain the values mandated below.

Value Requirements
id Not Required, but must be included in the submitted JSON. Set to 0
email Not Required, but must be included in the submitted JSON. Set to ""
password Not Required, but must be included in the submitted JSON. Set to ""
Name Not Required, but must be included in the submitted JSON. Set to ""
adminUser Not Required, but must be included in the submitted JSON. Set to 0
clientUser Not Required, but must be included in the submitted JSON. Set to 0.
sessionToken Required.
sessionExpiry Not Required, but must be included in the submitted JSON. Set to 0

Things To Note

Possible Errors