REST API Orders endpoint does not contain custom fields

Just like the subject states, the REST API orders and contact endpoints do not contain the custom fields for the orders nor is there any documentation on how to include them if that is an option. I get the same result with the UI test as well as the PHP SDK.

What I have tried:

Tried this because of the documentation on the contacts endpoint for retrieve a contact which works

//url: /crm/rest/v1/contacts/3?access_token=X&optional_properties=custom_fields
$infusionsoft->contacts()->with([“custom_fields”])->find(3)

but these do not return custom fields

//url: /crm/rest/v1/contacts?access_token=X&optional_properties=custom_fields
$infusionsoft->contacts()->where([‘optional_properties’ => “custom_fields”,])->get() (This one returns an empty array but has the placeholder)

//url: /crm/rest/v1/orders?access_token=X&optional_properties=custom_fields
$infusionsoft->orders()->where([‘optional_properties’=>“custom_fields”])->get();

//url: /crm/rest/v1/contacts?access_token=X
$infusionsoft->contacts()->with([“custom_fields”])->get()

//url: /crm/rest/v1/orders/11?access_token=X&optional_properties=custom_fields
$infusionsoft->orders()->with([“custom_fields”])->find(11)

//url: /crm/rest/v1/orders/11?access_token=X
$infusionsoft->orders()->find(11)

The only way to load the custom fields for a job is through the dataservice

//url: /crm/xmlrpc/v1?access_token=X
$infusionsoft->data()->load(‘Job’,11,[‘Id’, “_Shipped”, “_TrackingNumber”])

Is there a special way to get custom fields to return and if so what is it? If this is not a feature can we either make it one or remove the bad example from the documentation?

1 Like

I have also noticed that the ‘company’ property does not actually exist as documented. It only exists as a name on the ‘contact’ and ‘shipping_information’ properties. Also, the ‘contact’ property is very different from the documentation.

Did you ever figure out how to do this?

No idea why it made me create a new account, but no, I never got anywhere else with this. I honestly just stopped using the REST API for a lot of things because of drawbacks like this. The order model endpoint shows custom field but I don’t see a way to get it through the explorer page, and don’t really have the time to set up a test script to see.

Good luck!

Brandon_Rusimer (or anyone) – so I’m trying to figure out how to retrieve a contact with custom fields, and I found your post here - and this works:

$contacts = $infusionsoft->contacts()->with([‘custom_fields’])->find($contactId);

(I’m working in Laravel which is new to me + I’ve never worked in the REST api, only the legacy).

My question is – how did you know to use the ->with()?

I’d like to be able to read the documentation here -

https://keys.developer.keap.com/docs/keap-150k/1/routes/contacts/{id}/get

^ where they indicate that you can send the optional property – translate that into the code-

->with([‘custom_fields’])

When learning/using the legacy API – there was this whole page of PHP SDK that was all copy/paste-able plug and play -

like $app->dsFind( etc etc ).

Is there some convention that any REST API works with things like ->with() and if it says it’s an array - then use [ ] inside the ()?

Or is with() and get() and etc all specific to Infusionsoft’s library? If so - any suggestions on where I can better understand what things are available/what works?

Or do you know of any legacy API package available for Laravel 7?

Thanks!!

Jason

So the ->with() and all those similar pieces are a part of the IFS SDK when using the REST methods. I figured most of them out by just traversing the code; I am not sure if there is much documentation on using those though.

The Github page has some Laravel instructions here

The SDK also still allows you to easily use all of the legacy XML endpoints as well. It would look something like $ifs->data()->query(stuff). It can be a bit confusing but if you look here and choose the PHP option at the top right hand side it will show you SDK examples for each method.

Hope that helps!

@Brandon_rumiser1 - thank you SO MUCH for the quick response and the heads up that the legacy XML endpoints work!! OMG!

My IDE even fills in options after data()-> of the various methods, and the params required. PHP Storm FTW.

Hallelujah I love the new API ( because I can use the old API ? ha ha )

J