Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Alteryx is here to help you solve your biggest data challenges. Read about the new Virtual Solution Center here.

Requesting API using Alteryx

Highlighted
8 - Asteroid

Hello, 

I am trying to use Social bakers API to get the data from social media, I am not sure how to request it using Alteryx 

 

They have given this information for the basic request 

POST /1/facebook/page/posts HTTPS

Host: api.socialbakers.com

Authorization: Basic base64_encoded_auth

Content-Type: application/json; charset=utf-8

{ "profiles": ["164929129743", "354335677"], "date_start": "2010-01-01", "date_end": "2016-10-25", "fields": ["id"], "limit": 5 }

 

https://api.socialbakers.com/v1/#pagination

 

Also , they have mentioned also

The API is secured with HTTPS. Authentication is made using Basic HTTP Authorization by token and secret. The authorization is sent in the HTTP headers.

 

I have token and secret key but not sure how to request it with Alteryx Designer

 

Can someone help me in this regard ? 

Highlighted
Alteryx Certified Partner

@tjamal1 - the following community pages might be a good starting point on using the Download tool, and various methods involved in it:

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Guide-to-Creating-Your-Own-Connecto...

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Guide-to-Creating-Your-Own-Connecto...

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Tool-Mastery-Download/ta-p/29583

 

Reading through the socialbakers page, it looks like a two step process.

1) Create the authentication string and pass it to a URL, which will give you some form of cookie string

2) Use this cookie string to fetch data from another URL

 

Also, have you been able to fetch data from this site using a non-Alteryx approach? Just curious.

Highlighted
8 - Asteroid

Yes , I have used python to accomplished this but wondering if it would be easy do all those steps in Alteryx 

 

Can you help me configure download tool ? 

If you can utilize my example to prepare a workflow , then it would be very helpful 

Highlighted
8 - Asteroid

Also i can share my python script as well , if you say so 

Highlighted
Alteryx Certified Partner

Hi @tjamal1, I would love to collaborate on this problem statement. I have used the download tool in the past, but newer use cases are always fun to look. Please share your Python code if it is okay with you.

Highlighted
8 - Asteroid

Here it is.

import json 
import requests
from requests_oauthlib import OAuth1
from requests.auth import HTTPBasicAuth

r = requests.get('https://api.socialbakers.com/1/facebook/profiles',auth=HTTPBasicAuth('mytoken','mysecret'))

print(r.content)

json.loads(r.text)

 

Labels