ontraport / sdk-php Goto Github PK
View Code? Open in Web Editor NEWClient PHP Library for interacting with ONTRAPORT's RESTful API
Home Page: https://api.ontraport.com/doc/
License: MIT License
Client PHP Library for interacting with ONTRAPORT's RESTful API
Home Page: https://api.ontraport.com/doc/
License: MIT License
There seems to be an issue with adding tag by name to a custom object.
The response says The tag is now being processed." but upon checking the custom object record, tags are not reflecting
$tagByNameParams = array(
"objectID" => \OntraportAPI\ObjectType::CUSTOM_OBJECT,
"ids" => [10, 9],
"add_names" => ['Test Tag']
);
$response = $this->client->custom(10003)->addTagByName($tagByNameParams);
Am I missing something here?
It seems that there is no way to interface with the products objects using the PHP SDK. If I had an objectID, I could use the objects() interface, but it seems like the Products are a little different than the other objects. This leads me to think we have to use the restful Products/Product controllers to interact with our products.
If my above summary is correct, I've created an initial commit adding a Ontraport->product() method and a related Products class which supports the basic Products rest actions. I haven't thoroughly tested it yet, and I didn't document possible keys because that can be taken from the published API docs by the developer, no need to duplicate, I think.
https://github.com/jrebs/SDK-PHP/commit/acc4324fe771df8e96a571df22c14874476eb0c6
I'd appreciate your comment on whether this is the right solution and, if not, what is, or suggest changes to the above to make it service-ready.
Thanks
Hello! Quick question, is it possible to submit to an existing form created on Ontraport using the API?
I ask this since we already have a flow created on existing forms that categorizes leads, adds tags and subscribes to a certain newsletter.
Thank you!
How can I retrieve and interact with ONTRAforms?
1.2.1 is not on packagist.org, so we can't install it easily with Composer.
Hi, just want to ask regarding how to use the externs parameter, I've been checking the docs but it doesn't clearly says on how to construct the externs query string? If you could provide a sample it would be great as well, thanks.
Hello!
The composer package (and the 1.2.1 release in general) does not contain classes to control Tags.
Can you please update the version that you ship through composer?
I am not certain that this is a bug necessarily, but I've just spent a little while trying to get some updates to push to our custom objects and have now got it working by using another method.
Suppose a custom object with an objectID of 10001 and an object with ID of 1 that I wish to update. We have a custom field on this custom object that uses the field identifier "f1570" and contains a free formed string. f1570 currently has a value of 2.
$params = array('id' => 1, 'f1570' => 10);
$client->custom(10001)->saveOrUpdate($params);
This returns a code:0, no errors and returns the object's data in the response but the f1570 value does not update.
$params = array('objectID' ='10001', 'id' => 1, 'f1570' => 10);
$client->object()->saveOrUpdate($params);
The above should also work, to my knowledge, but it also returns a code:0 with the object data and does not update the custom field as requested.
$params = array('id' => 1, 'f1570' => 10);
$client->custom(10001)->update($params);
The update method DOES change the field as desired, returning a smaller set of data as usual when updates occur. Is there a problem with the saveOrUpdate implementation on custom objects or is this not supposed to work for some intended reason?
A PHP Error was encountered
Severity: Notice
Message: Only variables should be passed by reference
Filename: src/APIAutoloader.php
Line Number: 19
Backtrace:
File: /Applications/MAMPPRO/Sites/app.pum/SDK-PHP/src/APIAutoloader.php
Line: 19
Function: _error_handler
File: /Applications/MAMPPRO/Sites/app.pum/SDK-PHP/src/Ontraport.php
Line: 79
Function: spl_autoload_call
File: /Applications/MAMPPRO/Sites/app.pum/SDK-PHP/src/Ontraport.php
Line: 60
Function: setHttpClient
File: /Applications/MAMPPRO/Sites/app.pum/application/controllers/Update_views.php
Line: 13
Function: __construct
File: /Applications/MAMPPRO/Sites/app.pum/index.php
Line: 315
Function: require_once
We're trying to set the latest IP address for a contract via API. Is that possible? We don't see it referenced here: https://api.ontraport.com/doc/#update-a-contact
Or is there a field in the Smart- or Ontraforms to specific an IP address? It seems to be picked up automatically, but incorrect. It's getting the proxy's IP.
Hi, I'm having an issues with saveOrUpdate on the Contacts object.
Using this code here :
$payload = array (
'owner' => '',
'firstname' => 'Test',
'lastname' => 'Unique',
'email' => '[email protected]',
'address' => '',
'city' => '',
'f1666' => '133',
'zip' => '5051',
'f1665' => '',
'office_phone' => '040404040404',
'sms_number' => '040404040404',
'f1699' => '',
'f1700' => '',
'n_lead_source' => '',
'n_medium' => '',
'n_campaign' => '',
'n_term' => '',
'n_content' => ''
);
$response = $this->ontraport->contact()->saveOrUpdate( $payload );
If the Contact does not exist, the record is created OK and the created contact is returned.
However if I subsequently try this on a payload that looks like :
$payload = array (
'owner' => '',
'firstname' => 'Test',
'lastname' => 'Unique',
'email' => '[email protected]',
'address' => '',
'city' => '',
'f1666' => '133',
'zip' => '5051',
'f1665' => '',
'office_phone' => '0333333333',
'sms_number' => '0333333333',
'f1699' => '',
'f1700' => '',
'n_lead_source' => '',
'n_medium' => '',
'n_campaign' => '',
'n_term' => '',
'n_content' => ''
);
I get a response of :
'Save failed!'
What I'm expecting to happen is this contact record to be updated with the new office_phone and sms_number and have the new object returned.
Appreciate any insight.
Thanks
From the API documentation, it seems that if the response code is not a json success response with "code":"0", then the HTTP response code is meant to be used to diagnose the result (according to "Error and response codes" section of the API docs).
As an example, when I use the sdk to do a retrieveIdByEmail lookup on an email that doesn't exist in our account yet, I get back a simple string: "Object type with email '[email protected]' does not exist.".
It seems to me that the response code needs to be made available to the calling code. I can think of a few possible ways to go about it. Is this something that's already in the plans? I might have to come up with something on my end if it's not in the short term, in which case I'd be happy to hear your thoughts on the best implementation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.