Brainfuse API offers the ability for our partners to provide a single sign on system using a simple API.
A sequence diagram of the API looks like the picture below:
For all the URLs above there is a common prefix on the Brainfuse side:
For staging please use http://www.dev.brainfuse.com/jsp/api
For production please use https://www.brainfuse.com/jsp/api from this point onwards this prefix will be called server.
Request to get the user information:
Requests can be made using a get request.
To retrieve the user information please make a request to /getUserId/ for example to do a production request that would be https://www.brainfuse.com/jsp/api/getUserId/
Parameters:
t: launch code provided to the partner website in step 5
k: is an api key that is unique for each client. Please contact Brainfuse at [email protected] to retrieve a launch key.
Response:
Valid response is a json object of the following:
{
userid: <brainfuse userid>,
username: <brainfuse username>,
firstname: <firstname>,
lastname: <lastname>,
displayName: <brainfuse display name>
}
When using Jackson library or other json library please be sure to allow for changes in the object returned. New values can be added frequently.
Error Response:
When an error occur an additional HTTP header is added to the response. The HTTP header name is X-Error. The header includes the error message that the system has encountered.
Status Code | Status Message from the X-Error HTTP Header | Explanation |
---|---|---|
200 | Success | Request was successful |
400 | don't have launchCode | Launch code not provided |
400 | don't have key | Key is not provided |
400 | key is not correct | Key is not available on the list |
400 | code can not be decrypted | The code is not encrypted with a valid key |
400 | code is not correct | The code provided is not correct |
400 | Time limit passed for Token | The launch code have expired. Launch codes are only valid for 60 seconds. |
404 | user doesn't exist | The provided user id no longer exists in the system. |