Documentation

/authenticate [POST]

ThoughtFarmer REST API Method: /authenticate

Attempts to authenticate a user based on the passed in parameters. If successful, it returns a token that can be passed into the other API calls to represent the authenticated user.
 
URL:
http://yourserver.com/api/authenticate

Response Formats:
string

HTTP Method(s):
POST
 
Requires Authentication:
false (no token required), but the user attempting to authenticate must be a ThoughtFarmer administrator.

Parameters:

Parameter Type Description 
username string Required, if an Authorization header is not set. The username of the user to authenticate
password string Required, if an Authorization header is not set. The password of the user to authenticate
applicationId string Required. A valid application id that allows the client to make calls against the API, This can be found in the Admin Panel --> Configuration Settings page. Look for api.applicationCodes.
When ThoughtFarmer is configured to use an external login provider, the password and username parameter MUST be omitted, and an authorization header can be set with a REST API authentication token instead. A REST API authentication token can be generated in the admin panel, on the API Token page.

Response Status Codes:
200 - Authentication successful
401 - Error validating user or application id
 
Example request
POST http://yourserver.com/api/authenticate
HEADERS Content-Type: application/json
BODY {
    "username": "user",
    "password": "password",
    "applicationId:" 123456
}
 
Example request 2: Do not send username or password if you are using an Authorization header. If you do they will take precedence and the Authorization header will be ignored.
POST http://yourserver.com/api/authenticate
HEADERS Authorization: **********    (use your REST API token from the API token admin page)
Content-Type: application/json
BODY {
    "applicationId:" 123456
}
5349D7651EF7BC59AA4A27AEF4C3853A59ED5AF1D082A8BA0BE13397E5010549E2DD633536F580B04A4F84771FBD19F190755FE804D18CA2F15DBFD4A4E999326F2F72449622A2A0ED54A32BA3DC8660118569E061535F69F086CC30C4A32A8253B01713CE046CB145F533E1E1042D3EE852A0F9020D54B8D92EE2D719960F65DB6506232C93B57412A4167CC388637B