Field Selection

GET requests for the lgfapi entities support the “fields” query string parameters. It takes a comma-delimited list of field names for the entity and returns only those fields in the representation.

For example, to return only the “id” and “code” for all eligible companies using a list style request with no filters:

GET https://.../wms/lgfapi/v10/entity/company?fields=id,code

The “fields” parameter can be combined with filter parameters and other parameters with special meaning, like “format”. Here is a more complex example if one wanted to search for all eligible companies of type regular and return only the “id” and “company” for each company entity found, in XML format:

GET https://.../wms/lgfapi/v10/entity/company?fields=id,code&format=xml&company_type_id=1

This can also be applied to retrieve style request for a specific resource:

GET https://.../wms/lgfapi/v10/entity/company/1?fields=id,code

This is an important tool when performance is of concern. If it is known ahead of time that only specific field values are required, narrowing the returned data set using the “fields” parameter can greatly reduce the overall payload size and remove the need for unnecessary field and/or relation lookups.