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.
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.
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.
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:
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:
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.