Connection API \ Read connection details

Send a GET request to this resource to retrieve the details of a social network connection made on your Site.

Resource/URI GET POST PUT DELETE
Connections /connections.<format> List all connections
Connection /connections/<connection_token>.<format> Read connection details

Workflow

Implementation Example
  1. You have deployed Social Login on your website.
  2. One of your users uses the plugin to sign in with Facebook.
  3. The plugin sends a POST to your callback url.
  4. You extract the a connection_token from the POST data.
  5. You use the connection_token to get the connection details (including the user's Facebook profile data).

1. Request: the code to send to the API

Send a GET request to the resource /connections/<connection_token>.<format> to retrieve the details of a connection. The <connection_token> has to be replaced by the connection_token that our system previously send to your callback script.

2. Result: the code returned by the API

A connection contains the result of an interaction between one of your users and one of our plugins. If the connection contains a user profile from a social network (Facebook, Twitter ...), this data is wrapped into the Portable Contacts Format. Please note that the user profile may contain more or less data depending on the provider.

Example of a successfull connection:

{
	"response": {
		"request": {
			"date": "Thu, 25 Aug 2011 13:38:21  0200",
			"resource": "/connections/8875cb47-9b2e-40f9-8ae0-8428c06937a9.json",
			"status": {
				"flag": "success",
				"code": 200
			}
		},
		"result": {
			"status": {
				"flag": "success",
				"code": 200,
				"info": "The user successfully authenticated"
			},
			"data": {
				"connection": {
					"connection_token": "8875cb47-9b2e-40f9-8ae0-8428c06937a9",
					"date": "Thu, 25 Aug 2011 13:35:40 +0200",
					"plugin": "social_link"					
				},                        
				"user": {
					"user_token": "12345678-1234-1234-1234-123456789012",
					"identity": {
						"identity_token": "a3ba5j55-aacc-25ag-a4ah-ga4ahab3a2aa",
						"provider": "twitter",
						"id": "http://twitter.com/ExampleUser",
						"displayName": "Firstname Lastname",
						"name": {
							"formatted": "Firstname Lastname"
						},
						"preferredUsername": "MyUserNameRocks",
						"thumbnailUrl": "http://a1.twimg.com/sticky/default_profile_images/default_profile_6_normal.png",
						"urls": [{
								"value": "http://twitter.com/ExampleUser",
								"type": "profile"
							}
						],
						"accounts": [{
							"domain": "twitter.com",
							"userid": "123456789",
							"username": "ExampleUser"
							}
						],
						"photos": [{
								"value": "http://a1.twimg.com/sticky/default_profile_images/default_profile_6_normal.png",
								"type": "thumbnail"
							}
						]
					}
				}
			}
		}
	}
}

Example of a failed connection:

{
	"response":{
		"request":{
			"date":"Thu, 25 Aug 2011 14:03:17  0200",
			"resource": "/connections/8875cb47-9b2e-40f9-8ae0-8428c06937a9.json",
			"status":{
				"flag": "success",
				"code": 200
			}
		},
		"result":{
			"status":{
				"flag": "error",
				"code": 401,
				"info": "The user did not authenticate successfully"
			},
			"data":{
					"plugin":{
					"name": "social_link"
				}
			}
		}
	}
}