Filipe Ferminiano
Filipe Ferminiano

Reputation: 8791

Sending parameters with Pycurl to FB api

I'm trying to do this curl request with PyCurl from the documentation

curl -G \
-d "date_preset=last_7_days" \
-d "access_token=<ACCESS_TOKEN>" \
"https://graph.facebook.com/<API_VERSION>/<AD_CAMPAIGN_ID>/insights"

With the following code:

import pycurl
campaign_id = 'xxxxxx'
c = pycurl.Curl()
c.setopt(c.URL, "https://graph.facebook.com/2.4/campaign_id/insights?access_token=access_token")
c.perform()

But I'm getting this error:

{"error":{"message":"Unknown path components: \/6012304320061\/insights","type":"OAuthException","code":2500}}

Upvotes: 0

Views: 294

Answers (1)

Paul Bain
Paul Bain

Reputation: 4397

You are missing the version letter before version number:

"https://graph.facebook.com/v2.4/campaign_id/insights?access_token=access_token"

Upvotes: 2

Related Questions