# PHP Docs for REST

**URL:** <https://integration.keap.com/t/php-docs-for-rest/9921>\
**Category:** API Q&A\
**Created:** [August 10, 2017, 8:00pm UTC](https://integration.keap.com/t/php-docs-for-rest/9921 "2017-08-10T20:00:47Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Owen\_Lees](https://avatars.discourse-cdn.com/v4/letter/o/8797f3/32.png) [@Owen\_Lees](https://integration.keap.com/u/Owen_Lees)\
**Post date:** [August 10, 2017, 8:00pm UTC](https://integration.keap.com/t/php-docs-for-rest/9921/1 "2017-08-10T20:00:48Z")

</div>

Hi.  
After reading and experimenting (with quite a degree of frustration sadly) I have been able to get past the initial auth sequence and am now playing (trying to) with the PHP API which I have installed via composer.

Are there any docs for this helper class? I’m using an editor which shows me the class methods etc, but when for instance I do a call to -\>contacts() I get a _RECURSION_ error in the response.

This is clearly me not understanding which call to use, so can anyone point me at some docs which deal with the php sdk please?

---

<div class="post-metadata">

**Author:** ![Owen\_Lees](https://avatars.discourse-cdn.com/v4/letter/o/8797f3/32.png) [@Owen\_Lees](https://integration.keap.com/u/Owen_Lees)\
**Post date:** [August 10, 2017, 8:34pm UTC](https://integration.keap.com/t/php-docs-for-rest/9921/2 "2017-08-10T20:34:45Z")

</div>

Aaah… I may have answered my own question.  
Does the php sdk from GitHub only deal with the xml-rpc and not REST?

---

<div class="post-metadata">

**Author:** ![John\_Borelli](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/john_borelli/32/11880_2.png) [@John\_Borelli](https://integration.keap.com/u/John_Borelli)\
**Post date:** [August 10, 2017, 9:05pm UTC](https://integration.keap.com/t/php-docs-for-rest/9921/3 "2017-08-10T21:05:20Z")

</div>

So this is kind of a yes an no answer. RPC is an endpoint structure that separates function by url/directory structure. REST is a state based method using one url for each object (generally) so …/contact might be a REST endpoint. The method or state that you use determines the function. So to get a list of contacts you might send a GET request to the …/contact endpoint. In RPC the endpoint to get a list might be more like …/contact/v1/list/get which ends with the function in question. So support files are not needed for REST as any post, put, get etc method can be used to the same endpoint via standard HTTP protocols like cURL. So the xml-rpc files (from github) don’t contain support files for REST ‘per se’ except for webhook registration and oauth authentication but they do contain the Infusionsoft object that is a container for all the other objects (contact, group/tag etc) which handles the rpc calls for you.

---

<div class="post-metadata">

**Author:** ![MichaelFairchild](https://sea1.discourse-cdn.com/flex019/user_avatar/integration.keap.com/michaelfairchild/32/111_2.png) [@MichaelFairchild](https://integration.keap.com/u/MichaelFairchild)\
**Post date:** [August 11, 2017, 1:06am UTC](https://integration.keap.com/t/php-docs-for-rest/9921/4 "2017-08-11T01:06:06Z")

</div>

The Rest services in the PHP SDK are based [Laravel’s Eloquent model](https://laravel.com/docs/5.4/eloquent). The Readme in the sdk has some basic examples of how to use it. [GitHub - infusionsoft/infusionsoft-php: PHP client library for the Infusionsoft API.](https://github.com/infusionsoft/infusionsoft-php#making-rest-requests)

Take a look at those docs in the readme and let me know if that doesn’t get you going.

---

<div class="post-metadata">

**Author:** ![Owen\_Lees](https://avatars.discourse-cdn.com/v4/letter/o/8797f3/32.png) [@Owen\_Lees](https://integration.keap.com/u/Owen_Lees)\
**Post date:** [August 11, 2017, 1:35pm UTC](https://integration.keap.com/t/php-docs-for-rest/9921/5 "2017-08-11T13:35:11Z")

</div>

Hi and thanks for the answer, I was reading the release notes for the SDK which implied that the REST endpoints were as you say - and the class would load the REST side of things first unless explicitly told not to (so far so good).

I wonder if I have an old version of the SDK now, as the methods for task (for instance) do not contain the all() method which is noted within the Github docs.

I also can see the contacts() endpoint - but on using it I get an _RECURSION_ error in the body returned.

I do not get this recursion error if I simply use Guzzle separately and make a REST GET request to /contacts.

---

<div class="post-metadata">

**Author:** ![Owen\_Lees](https://avatars.discourse-cdn.com/v4/letter/o/8797f3/32.png) [@Owen\_Lees](https://integration.keap.com/u/Owen_Lees)\
**Post date:** [August 11, 2017, 1:38pm UTC](https://integration.keap.com/t/php-docs-for-rest/9921/6 "2017-08-11T13:38:03Z")

</div>

Hi Michael  
I have indeed looked at the docs and interrogated the source code of the SDK acquired via composer - which appears to be at odds with the docs, I wonder if you could identify which version is in fact the latest version of the SDK?

---

<div class="post-metadata">

**Author:** ![Owen\_Lees](https://avatars.discourse-cdn.com/v4/letter/o/8797f3/32.png) [@Owen\_Lees](https://integration.keap.com/u/Owen_Lees)\
**Post date:** [August 11, 2017, 2:04pm UTC](https://integration.keap.com/t/php-docs-for-rest/9921/7 "2017-08-11T14:04:38Z")

</div>

I downloaded the DEV Beta version 5, am now downloading 1.3…

---

<div class="post-metadata">

**Author:** ![Owen\_Lees](https://avatars.discourse-cdn.com/v4/letter/o/8797f3/32.png) [@Owen\_Lees](https://integration.keap.com/u/Owen_Lees)\
**Post date:** [August 11, 2017, 6:02pm UTC](https://integration.keap.com/t/php-docs-for-rest/9921/8 "2017-08-11T18:02:15Z")

</div>

The return now is not _RECURSION_ but rather nothing (at least it returns an object, but nothing in the object that would be considered useful.

So… can you think why the Guzzle request to the API “/contacts” would return correctly and the same request to “$infusionsoft-\>contacts()” (using sdk 1.3) returns differently?

When i do the Guzzle version i get a list of contacts back (correctly) - with the sdk i get this:

> object(Infusionsoft\Api\Rest\ContactService)#38 (11) {  
> [“full\_url”] =\> string(49) “[https://api.infusionsoft.com/crm/rest/v1/contacts](https://api.infusionsoft.com/crm/rest/v1/contacts)”  
> [“updateVerb”:protected] =\> string(5) “patch”  
> [“return\_key”] =\> string(8) “contacts”  
> [“client”:protected] =\> object(Infusionsoft\Infusionsoft)#19 (13) {  
> [“url”:protected] =\> string(42) “[https://api.infusionsoft.com/crm/xmlrpc/v1](https://api.infusionsoft.com/crm/xmlrpc/v1)”  
> [“auth”:protected] =\> string(51) “[https://signin.infusionsoft.com/app/oauth/authorize](https://signin.infusionsoft.com/app/oauth/authorize)”  
> [“tokenUri”:protected] =\> string(34) “[https://api.infusionsoft.com/token](https://api.infusionsoft.com/token)”  
> [“clientId”:protected] =\> string(24) “_**"  
> [“clientSecret”:protected] =\> string(10) ""  
> [“redirectUri”:protected] =\> string(48) ""  
> [“apis”:protected] =\> array(0) {  
> }  
> [“debug”:protected] =\> bool(true)  
> [“httpClient”:protected] =\> NULL  
> [“httpLogAdapter”:protected] =\> NULL  
> [“serializer”:protected] =\> NULL  
> [“needsEmptyKey”] =\> bool(true)  
> [“token”:protected] =\> object(Infusionsoft\Token)#18 (4) {  
> [“accessToken”] =\> string(24) " **__**"  
> [“refreshToken”] =\> string(24) "**_\*\*”  
> [“endOfLife”] =\> int(1502560005)  
> [“extraInfo”] =\> array(2) {  
> [“token\_type”] =\> string(6) “bearer”  
> [“scope”] =\> string(27) “full|\*\*\*\*.infusionsoft.com”  
> }  
> }  
> }  
> [“where”:protected] =\> array(0) {  
> }  
> [“optionalProperities”:protected] =\> array(0) {  
> }  
> [“attributes”:protected] =\> array(0) {  
> }  
> [“hidden”:protected] =\> array(0) {  
> }  
> [“visible”:protected] =\> array(0) {  
> }  
> [“appends”:protected] =\> array(0) {  
> }  
> [“casts”:protected] =\> array(0) {  
> }  
> }

---

<div class="post-metadata">

**Author:** ![Owen\_Lees](https://avatars.discourse-cdn.com/v4/letter/o/8797f3/32.png) [@Owen\_Lees](https://integration.keap.com/u/Owen_Lees)\
**Post date:** [August 12, 2017, 12:25pm UTC](https://integration.keap.com/t/php-docs-for-rest/9921/9 "2017-08-12T12:25:43Z")

</div>

The download and further forays into the code fixed this for me - using all().

Thanks for the pointers.
