Comments (7)
You'll need to switch to a different way of doing your CURL - the documentation tells you to switch, but doesn't tell you WHAT to do instead - this is what i've written, and it's working for me!
$curl = curl_init();
curl_setopt_array( $curl, array(
CURLOPT_URL => $this->url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => 'email='.$this->email.'&password='.$this->password.'&user_key='.$this->user_key,
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
"content-type: application/x-www-form-urlencoded",
)
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
$xml = new SimpleXMLElement( $response );
$obj = $xml->api_key;
$key = (string) $obj{0};
return $key;
from api-docs.
From their support:
First of all, please note you need to use the version 4 for all your calls as you have AMPSEA enabled (https://help.salesforce.com/articleView?id=pardot_admin_ampsea_parent.htm&type=5).
Also, there was a change made on the 14th of February that means you will no longer be able to authenticate with the Pardot API using an HTTP authorisation header, which essentially translates to not being able to authenticate with the Pardot API using your credentials in the URL/header.
For example, you will no longer be able to authenticate with Pardot and generate an API key using the following method:
https://pi.pardot.com/api/login/version/[email protected]&password=XXXXXXXXX&user_key=XXXXXXX
You would need to have your credentials as parameters in the body of the API request, as mentioned in the Pardot API documentation below:
Something to note, the method stated doesn't work and their API documentation that they link to says something completely different.
from api-docs.
Interestingly, the above works in postman, but not in php, returning "Login Failed".
from api-docs.
You'll need to switch to a different way of doing your CURL - the documentation tells you to switch, but doesn't tell you WHAT to do instead - this is what i've written, and it's working for me!
$curl = curl_init();
curl_setopt_array( $curl, array( CURLOPT_URL => $this->url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => 'email='.$this->email.'&password='.$this->password.'&user_key='.$this->user_key, CURLOPT_HTTPHEADER => array( "cache-control: no-cache", "content-type: application/x-www-form-urlencoded", ) )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); $xml = new SimpleXMLElement( $response ); $obj = $xml->api_key; $key = (string) $obj{0}; return $key;
Now it is working fine Thanks.
from api-docs.
Authentication is documented in the developer documentation. This source repository is for the documentation and is not a channel for support. If you need assistance or help with Pardot, please contact Pardot Support.
from api-docs.
From their support:
First of all, please note you need to use the version 4 for all your calls as you have AMPSEA enabled (https://help.salesforce.com/articleView?id=pardot_admin_ampsea_parent.htm&type=5).
Also, there was a change made on the 14th of February that means you will no longer be able to authenticate with the Pardot API using an HTTP authorisation header, which essentially translates to not being able to authenticate with the Pardot API using your credentials in the URL/header.
For example, you will no longer be able to authenticate with Pardot and generate an API key using the following method:
https://pi.pardot.com/api/login/version/[email protected]&password=XXXXXXXXX&user_key=XXXXXXX
You would need to have your credentials as parameters in the body of the API request, as mentioned in the Pardot API documentation below:
http://developer.pardot.com/#authenticationSomething to note, the method stated doesn't work and their API documentation that they link to says something completely different.
@Art-em1s Did you have any luck on this? I'm trying the same way, but in Python. It's working only if the Content-type is "application/x-www-form-urlencoded", but if it's JSON it's failing.
from api-docs.
If you are using the "requests" module:
import requests, json
userKey = '<user_key>'
password = '<password>'
email = '<email>'
r = requests.post('https://pi.pardot.com/api/login', params = {'format': 'json'}, data = {'user_key': userKey, 'email': email, 'password': password})
j = json.loads(r.text)
print(j['api_key'])
If you are using the standard Python 3 libraries:
import http.client, urllib.parse, json
userKey = '<user_key>'
password = '<password>'
email = '<email>'
params = urllib.parse.urlencode({'user_key': userKey, 'email': email, 'password': password});
headers = {"Content-type": "application/x-www-form-urlencoded"}
conn = http.client.HTTPSConnection('pi.pardot.com')
conn.request('POST', '/api/login?format=json', params, headers)
response = conn.getresponse()
data = response.read()
conn.close()
j = json.loads(data)
print(j['api_key'])
from api-docs.
Related Issues (20)
- API-Pardot : Get only new visits
- [Querying Email Stats] Display additional tags
- IP Location Activation - API HOT 5
- Add a header to the response to indicate the expiry time of the api key HOT 1
- Bulk call to prospect seems to hang after 30 Iterations HOT 1
- API - Get all email template ids HOT 1
- Max characters HOT 4
- API - %%unsubscribe%% vs {{unsubscribe}} HOT 1
- Unable to query the Lists. HOT 1
- Updated PHP sample from with new API Auth requirements http://developer.pardot.com/ HOT 2
- API call is failing HOT 1
- OAuth in react-native HOT 2
- [CustomFields] How do you get dropdown values? HOT 1
- <type> on Visitor Activity differs from what's on the documentation HOT 3
- Access Denied via Salesforce OAuth HOT 2
- batchUpdate error Input needs to be valid JSON or XML HOT 1
- Error code 49 should reference the possibility of using an incorrect BU ID HOT 1
- Issue with v5 Documentation for Prospect Create HOT 5
- [Pardot V5 API] Missing documentation explaining how to use Custom Fields HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from api-docs.