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
$infusionsoft->contacts()->where([‘optional_properties’ => “custom_fields”,])->get() (This one returns an empty array but has the placeholder)
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.
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.
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.