These API calls deal with users.
You can:
- obtain an authentication key (Auth) for future requests
- display detailed information about the user
- set the authenticated user’s name/ avatar
- show client accounts user is connected to and user’s permission level on each account
- create an anonymous account for commenting
…………………………………………………………………………………………………………..
Obtain Authentication Key
GET /user 123
HTTP Basic authentication to obtain an authentication key (Auth) for future requests. An authentication key will last for a up to 2 hours or until the user’s password is changed.
Options
Parameter | Required | Type | Description |
---|---|---|---|
Token | true | string | The token is a dedicated authorization key provided to the client to consume the API. |
Username | true | string | The email address of the user being authenticated to make calls to the API. |
Password | true | string | The password of the user being authenticated. |
Format | – | string | Format of the data returned by the API call. Can be either “xml”, “csv” or “json” |
Example HTTP and HTTPS Requests
http://username:password@apiv1.scribblelive.com/user/?Token=xxxxxxxx&Format=json https://username:password@apiv1secure.scribblelive.com/user/?Token=xxxxxxxx&Format=json
Example JSON Response
Example JSON Responsehttp://username:password@apiv1.scribblelive.com/user/?Token=xxxxxxxx&Format=json https://username:password@apiv1secure.scribblelive.com/user/?Token=xxxxxxxx&Format=json
{ "Id": 22213487, "Name": "graeme.macfarlane", "Avatar": "http://avatars.scribblelive.com/2013/2/22/c819acec-1485-4780-acc1-a84b423346b9.jpg", "Auth": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }
Example code (PHP)
<?php define("API_TOKEN","xxxxxxxx"); define("USERNAME","graeme.macfarlane@scribblelive.com"); define("PASSWORD","xxxxxxxxxxxxxxxxx"); $url = "https://apiv1secure.scribblelive.com/user/?Token=".API_TOKEN."&Format=json"; print get_data($url,USERNAME,PASSWORD); function get_data($url,$username,$password) { $ch = curl_init(); $timeout = 5; curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password); curl_setopt($ch, CURLOPT_HTTPHEADER,array('Content-Type: application/json')); $data = curl_exec($ch); curl_close($ch); return $data; } ?>
…………………………………………………………………………………………………………..
Display User Information
GET /user/{User Id}
Displays detailed information about the user with id {User Id}.
Options
Parameter | Type | Description | Required |
---|---|---|---|
User Id | Integer | The ID of the user whose information is being retrieved. | Yes |
Token | String | The token is a dedicated authorization key provided to the client to consume the API. | Yes |
Auth | String | The authentication key ensures the user of the API has been authenticated to use the service. The authentication key can be obtained by making a call to /user with the user’s credentials. | Yes |
Format | String | Format of the data returned by the API call. Can be either “xml”, “csv” or “json” | No |
Example HTTP and HTTPS Requests
http://apiv1.scribblelive.com/user/22213487/?Token=xxxxxxxx&Auth=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&Format=json https://apiv1secure.scribblelive.com/user/22213487/?Token=xxxxxxxx&Auth=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&Format=json
Example JSON Response
{ "Id": 22213487, "Name": "graeme.macfarlane", "Avatar": "http://avatars.scribblelive.com/2013/2/22/c819acec-1485-4780-acc1-a84b423346b9.jpg" }
…………………………………………………………………………………………………………..
Set the User’s Name or Avatar
GET /user, POST /user
Sets the authenticated user’s name (GET)
Sets the authenticated user’s avatar (POST)
Options
Parameter | Type | Description | Required |
---|---|---|---|
Token | String | The token is a dedicated authorization key provided to the client to consume the API. | Yes |
Name | String | The name that the user’s name should be set to. | Yes |
Auth | String | The authentication key ensures the user of the API has been authenticated to use the service. The authentication key can be obtained by making a call to /user with the user’s credentials. | Yes |
Format | String | Format of the data returned by the API call. Can be either “xml”, “csv” or “json” | No |
Example HTTP and HTTPS Requests
http://apiv1.scribblelive.com/user/?Token=xxxxxxxx&Name={New name}&Auth=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&Format=json https://apiv1secure.scribblelive.com/user/?Token=xxxxxxxx&Name={New name}&Auth=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&Format=json
Example JSON Response
{ "Id":22213487, "Name":"Graeme MacFarlane", "Avatar":"http://avatars.scribblelive.com/2013/2/22/c819acec-1485-4780-acc1-a84b423346b9.jpg" }
Example code (HTML POST image)
<html> <body> <form action="http://apiv1.scribblelive.com/user/?Token=xxxxxxxx&Auth=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&Format=json" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file"><br> <input type="submit" name="submit" value="Submit"> </form> </body> </html>
…………………………………………………………………………………………………………..
Show User Account Details
GET /user/{User Id}/clients
Shows all the clients to which the user account is connected, and the user’s respective client permissions on each.
Options
Parameter | Type | Description | Required |
---|---|---|---|
User Id | Integer | The ID of the user to get information about. | Yes |
Token | String | The token is a dedicated authorization key provided to the client to consume the API. | Yes |
Auth | String | The authentication key ensures the user of the API has been authenticated to use the service. The authentication key can be obtained by making a call to /user with the user’s credentials. | Yes |
Format | String | Format of the data returned by the API call. Can be either “xml”, “csv” or “json” | No |
Example HTTP and HTTPS Requests
http://apiv1.scribblelive.com/user/22213487/clients/?Token=xxxxxxxx&Auth=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&Format=json https://apiv1secure.scribblelive.com/user/22213487/clients/?Token=xxxxxxxx&Auth=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&Format=json
Example JSON Response
{ "Id": 22186035, "Name": "Graeme MacFarlane", "Avatar": "http://avatars.scribblelive.com/2012/11/16/0a05c2fe-c9da-46dc-aba1-f870d9808eb6.jpg", "Clients": [{ "Id": 7515, "Name": "Graeme's ScribbleLive", "Permissions": "Administrator", "Websites": [{ "Id": 535, "Name": "white label test", "Url": "http://live.example.com//" }] }] }
…………………………………………………………………………………………………………..
Create an Anonymous Account
GET /user/create, POST /user/create
Creates an anonymous account for commenting. Can use HTTP GET or POST.
If an image file is included via HTTP POST, image will be resized to 50px by 50px and used as the avatar of the user account.
{IP Address} should be the current IP of the user, but is optional. If it is not passed, we’ll automatically use the IP of the request.
Options
Parameter | Type | Description | Required |
---|---|---|---|
Token | String | The token is a dedicated authorization key provided to the client to consume the API. | Yes |
Name | String | The name of the anonymous user that is to be created. | Yes |
Auth | String | The authentication key ensures the user of the API has been authenticated to use the service. The authentication key can be obtained by making a call to /user with the user’s credentials. | Yes |
IP | String | The IP address of the anonymous user | No |
Format | String | Format of the data returned by the API call. Can be either “xml”, “csv” or “json” | No |
Example HTTP and HTTPS Requests
http://apiv1.scribblelive.com/user/create/?Token=xxxxxxxx&Name=thomas&Auth=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&Format=json https://apiv1secure.scribblelive.com/user/create/?Token=xxxxxxxx&Name=thomas&Auth=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&Format=json
Example JSON Response
{ "Id":27623019, "Name":"thomas", "Avatar":"", "Auth":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }
Example code (HTML POST image)
<html> <body> <form action="http://apiv1.scribblelive.com/user/create/?Token=xxxxxxxx&Name=thomas&Auth=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&format=json" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file"><br> <input type="submit" name="submit" value="Submit"> </form> </body> </html>