If you integrate quintly into your own Analytics solution and wish to connect to private level statistics, the problem often faced is how to authenticate with users who don’t have access to quintly. With our API authentication flow, we provide a solution for this.

Prerequisites

To authenticate a social media profile with quintly via the API, you need your API credentials, a user id, a space id, a profile id and finally the type of authentication.

You can get the API credentials from our customer success team. For the user and space id, our customer success team can also help. We recommend to set up at least a specific user in quintly for authentication only. We also believe it’s a best practice to have a dedicated space in the quintly tool for keeping the profiles used via the API separated from profiles used in the tool.

Learn more about spaces in quintly.

The ids of your profiles you can get via calling the https://api.quintly.com/v0.9/list-profiles

API endpoint.

Here is a list of available authentication types:

If you have all the pieces together, you can exchange the information for a link that can be used for authentication.

https://api.quintly.com/v0.9/generate-private-statistics-authentication-link?spaceId=<spaceId>&profileId=<profileId>&userId=<userId>&authType=<authenticationType>

Example

Here is an example of how a full flow would look like. In this example we will add a new Facebook profile, go through the authentication flow and finally get the impressions of the profile.

In my example, my space has the id 147911 and my user 150129. At the moment it’s not easy to find especially the space id, while the user id can be seen in the url when editing a user in the tool. If you can’t manage to find the ids, please reach out to our customer success team. For accessing the impressions, the profile has to be authenticated with the facebookInsights authentication type.

1.a Adding the profile

Assuming the profile is not already added to your account, you can add it via a call to the add-profile API endpoint. The way to go is to add the URL to your social profile as a value for the parameter q. You need also to specify the space the profile should be added to.

https://api.quintly.com/v0.9/add-profile?spaceId=147911&q=https://www.facebook.com/quintly

The result will look like this:

{

"success":true,

"data":{

"url":"https://www.facebook.com/quintly/",

"id":92

}

}

The id returned is the profile id you need in order to authenticate.

1.b Searching an existing profile

Assuming the profile is already in your quintly account, you can query it with the list-profiles API endpoint.

https://api.quintly.com/v0.9/list-profiles

The result will look like this:

{
"success":true,
"data":[
{
"id":92,
"name":"quintly",

"platformUsername":"quintly",

"spaces[
{
"id":147911,
"name":"API Space"
}
],
}
]
}

In this case you get both the profile and the space id.

2. Query the authentication link

To get the authentication link, in this scenario we want to authenticate for Facebook Insights, the query looks like this:

https://api.quintly.com/v0.9/generate-private-statistics-authentication-link?spaceId=147911&profileId=92&userId=150129&authType=facebookInsights

The result looks like this:

{
"success": true,
"data": {
"link": "https:\/\/quint.ly\/2MifnAH"
}
}

With this link (valid for 7 days) you can redirect the user so that he can authenticate his Facebook profile.

The user gets to see the connect dialog.

After he clicks on connect, he will get asked for authenticating the profile with Facebook, including the necessary permissions.

After the user has accepted the authentication he will get redirected to a success page. The pages insights are now accessible.

3. Querying Insights data

Our motivation to have the profile authenticated was to retrieve the pages impressions measure. To check if everything worked, we start with a rather simple query:

https://api.quintly.com/v0.9/qql?qqlQuery=SELECT%20profileId,%20time,%20page_impressions%20FROM%20facebookInsights&startTime=2018-04-07&endTime=2018-04-07&interval=day&profileIds=92

The output should look like this:

{
"success": true,
"data": [
{
"profileId": 92,
"time": "2018-04-07 00:00:00",
"page_impressions": 5063
}
]
}

We have now managed to connect a profile with Facebook Insights and retrieve Insights data.

Did this answer your question?