/get_contacts

The get_contacts call uses the apiKey and identifier to return a list of all the contacts related to the user. The data returned and the type of relationship differs between Identity Providers.

Before using get_contacts you must enable contacts for the Identity Provider in the Janrain Dashboard.

The Identity Providers that support this call are:

  • Facebook — Only for apps created before April 30th, 2014. Apps created after this date do not have access to get_contacts. Please refer to this support notification for more information.
  • Google — Deprecated
  • Google+ — Does not support friendships, followers, or friends. Does support addressBook and following
  • Twitter — Does not support friends. Does support followers, following, and friendships. See get_contacts Response for more details.
  • Yahoo!
  • Windows Live
  • Salesforce
  • Disqus
  • Mixi
  • Myspace
  • Sina Weibo
  • RenRen
  • Soundcloud
  • Tencent Weibo
  • Tumblr
  • VK — Does not support friendships. Does support friends, followers, and following. See get_contacts Response for more details.

Accepted Content-types

  • application/x-www-form-urlencoded
  • multipart/form-data

This endpoint includes the following methods:

  • POST


POST

Authentication

This endpoint supports Basic authentication. To create an authentication string, combine your API client ID, a colon (:), and your client secret into a single value. For example, if your client ID is abcdefg and your client secret is hijklmnop, that value would look like this:

abcdefg:hijklmnop

Next, take the string and base64 encode it.

For example, on a Mac, you can base encode the string using this command:

echo -n "abcdefg:hijklmnop" | base64

If you’re running Microsoft Windows, you can encode the string by using a Windows PowerShell command similar to this:

[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("abcdefg:hijklmn"))

The resulting value (e.g., YWJjZGVmZzpoaWprbG1ub3A=) should be used in your authentication header.

If you are making API calls using Postman, select Basic Auth as your identification type, then use the client ID as the username and the client secret as the password.

Make sure that your API client has the all the permissions (for example, the right to read user profile information) needed to complete the API call.

Base URL

The base URL for this endpoint is your application domain followed by /api/v2; for example:

https://educationcenter.rpxnow.com/api/v2

You can find your application domain in the Social Login (Engage Dashboard) on the Settings page:

Example Request


curl -X POST \
    --data-urlencode apiKey=1234567891234567891234567891234567891234\
    --data-urlencode identifier=0987098709870987 \
    --data-urlencode contactType=friends \
    https://janrain-docs.rpxnow.com/api/v2/get_contacts
    

Example Response


{
  "response": {
    "startIndex": 1,
    "entry": [
      {
        "emails": [
          {
            "type": "other",
            "value": "bob@example.com"
          }
        ],
        "displayName": "Bob Johnson"
      },
      {
        "emails": [
          {
            "type": "other",
            "value": "cindy.smith@example.com"
          }
        ],
        "displayName": "Cindy Smith"
      },
      {
        "emails": [
          {
            "type": "other",
            "value": "fred.williams@example.com"
          }
        ],
        "displayName": "Fred Williams"
      },
      {
        "emails": [
          {
            "type": "other",
            "value": "j.lewis@example.com"
          }
        ]
      },
      {
        "emails": [
          {
            "type": "other",
            "value": "mary.jones@example.com"
          }
        ],
        "displayName": "Mary Jones"
      },
      {
        "emails": [
          {
            "type": "other",
            "value": "p.green@example.com"
          }
        ],
        "displayName": "Patricia Green"
      }
    ],
    "itemsPerPage": 5,
    "totalResults": 5
  },
  "stat": "ok"
}    

Running Code Samples Using Postman

The Janrain REST API code samples are written using Curl, but they can easily be run from within Postman. To use one of our code samples in Postman:

  1. Click the Copy to Clipboard button located directly beneath the code sample
  2. In Postman, click Import to display the Import dialog box.
  3. In the Import dialog box, click Paste Raw Text, and then paste in the copied code. The Import dialog box should look similar to this:

  4. Click Import, and the Curl command will be converted to a format that can be run from within Postman. All you need to do now is configure the command to work with your Janrain implementation.

Query Parameters

Parameter Type Required Description
apiKey string Yes Social Login API key. This key can be found on the Janrain Dashboard.
 
contactType string Specify friends to return identifiers for every friend of the user. If you do not specify a value, friends will be returned if available.

Twitter does not support the friends contactType. Instead specify followers, following, or friendships. If you do not specify a value, following will be returned.
 
  • followers – the people following the user.
  • following – the people the user is currently following. For Google+ this includes the users "circles."
  • friendships – The people for whom followers and following are both true.
  • addressBook – this value is for Google+ only, it gets the user's whole address book.

Note that VK supports followers and following, but not friendships. No other providers support any of these values, and will return an error.

existingUser string When set to true, returns a value that identifies whether a user has previously authenticated with the Janrain application.
 
identifier string Yes Identifier returned from the auth_info API call.

The application must be configured to request this information in the Provider Configuration screen. In addition, the visitor must approve this request during sign-in. The auth_info access Credentials section includes an expiration time for the permissions that enable get_contacts. This call must be made before the expiration time.
 
providerFields string Comma-separated list of provider specific profile fields to return the associated data. This option is supported by Faceboo, LinkedIn, Mixi, Salesforce, VK, and Xing, and is ignored if used with other providers.

Note that no validation is performed: if you specify an incorrect field name then an error is likely to occur. Check the provider's documentation for valid profile fields.
 

Responses

200 OK

Response Fields

Field

Type

Description

response

array

User Profile data representing the address book contents for the identifier.