Adjust Number of Fields to be Returned from a Request

It is possible to adjust the number of fields that are to be returned from a resource. It's possible to both increase and decreases the number of fields from the default view. So if only field A and B from a resource is needed and the other X number of fields can be ignored, it can be specified in the header of the request. This will reduce the overhead of data transferred and improve performance. If more fields are needed in one request, to avoid making a second request to get all the data that is needed, this can also be done. So if fields A, B and C are returned in the default view, but also field D is needed, this can be specified in the header.

Customize the Number of Fields returned

Retrieving data from a resource may provide more information than needed. Fields with data to be returned can be specified by first adding a header field and then specifying the fields to be returned in the header field value. The header field value is specified as a JSON message following the same structure as the resource structure that is used when making the request. This enables fields to be specified in main- and sub-objects.

The examples listed illustrate how it is used for a business partner. The procedure is, however, the same for all resources. The key and self attribute will always be returned, but the number of displayed/hidden fields can be customized.

Business Partner without any field restriction will result in ( view example):

{
    "businessPartnerName": "Big Customer",
    "businessPartnerSort": "BIG.",
    "businessPartnerCode": "45999",
    "codeProperty": "businessPartnerCode",
    "bankAccounts": [],
    "individuals": [],
    "user": null,
    "createdDate": "2014-01-27T18:38:52",
    "changedById": 3689599,
    "createdById": 1045293,
    "externalObjectKey": null,
    "modifiedDate": "2024-09-29T10:59:34",
    "portAgentType": null,
    "bankAccount": null,
    "paymentTerms": {
        "key": 1004281,
        "self": "https://dev.dataloy.com/ws/rest/PaymentTerms/1004281"
    },
    "businessUnit": {
        "key": 1000576,
        "self": "https://dev.dataloy.com/ws/rest/BusinessUnit/1000576"
    },
    "baselineTerm": {
        "key": 1004265,
        "self": "https://dev.dataloy.com/ws/rest/BaselineTerm/1004265"
    },
    "contactInfo": [
        {
            "key": 5987711,
            "self": "https://dev.dataloy.com/ws/rest/ContactInfo/5987711"
        }
    ],
    "businessPartnerName2": null,
    "companyRegistrationNo": "987987987",
    "isInterCompany": false,
    "isTotalCommissionPayable": false,
    "maxAdvancePaymentPercent": 100,
    "rating": null,
    "ratingExpiryDate": null,
    "vatNumber": null,
    "addresses": [
        {
            "key": 5993125,
            "self": "https://dev.dataloy.com/ws/rest/Address/5993125"
        }
    ],
    "businessPartnerLink": {
        "key": 1004433,
        "self": "https://dev.dataloy.com/ws/rest/BusinessPartner/1004433"
    },
    "businessPartnerType": {
        "key": 1000032,
        "self": "https://dev.dataloy.com/ws/rest/BusinessPartnerType/1000032"
    },
    "companyBankAccount": null,
    "www": [
        {
            "key": 5987713,
            "self": "https://dev.dataloy.com/ws/rest/Www/5987713"
        }
    ],
    "payee": {
        "key": 1004433,
        "self": "https://dev.dataloy.com/ws/rest/BusinessPartner/1004433"
    },
    "remarks": [],
    "isObjectActive": true,
    "key": 1045574,
    "self": "https://dev.dataloy.com/ws/rest/BusinessPartner/1045574"
}

Examples

1. Return Business Partner name only:

fields: {"businessPartnerName":"*"}

{
  "businessPartnerName": "Big Customer",
  "self": "https://dev.dataloy.com/ws/rest/BusinessPartner/1045574",
  "key": 1045574
}

2. Return address1 only:

fields: {"addresses": {"address1":"*"}}

Note that addresses is an array, but for the fields value it should be treated as a field, so do not include [ ]

{
  "addresses": [
    {
      "address1": "Halfdan Kjerulfs gate 4",
      "key": 5993125,
      "self": "https://dev.dataloy.com/ws/rest/Address/5993125"
    }
  ],
  "self": "https://dev.dataloy.com/ws/rest/BusinessPartner/1045574",
  "key": 1045574
}

3. Return Business Partner name and address1:

fields: {"businessPartnerName":"*", "addresses":{"address1":"*"}}

{
  "businessPartnerName": "Big Customer",
  "addresses": [
    {
      "address1": "Halfdan Kjerulfs gate 4",
      "key": 5993125,
      "self": "https://dev.dataloy.com/ws/rest/Address/5993125"
    }
  ],
 "self": "https://dev.dataloy.com/ws/rest/BusinessPartner/1045574",
 "key": 1045574
}

4. Return all BusinessPartner and its BusinessUnit fields:

fields: {"all":"*", "businessUnit":{"all":"*"}}


{
    "businessPartnerName": "Big Customer",
    "businessPartnerSort": "BIG.",
    "businessPartnerCode": "45999",
    "codeProperty": "businessPartnerCode",
    "bankAccounts": [],
    "individuals": [],
    "user": null,
    "createdDate": "2014-01-27T18:38:52",
    "changedById": 3689599,
    "createdById": 1045293,
    "externalObjectKey": null,
    "modifiedDate": "2024-09-29T10:59:34",
    "portAgentType": null,
    "bankAccount": null,
    "paymentTerms": {
        "key": 1004281,
        "self": "https://dev.dataloy.com/ws/rest/PaymentTerms/1004281"
    },
    "businessUnit": {
        "key": 1000576,
        "self": "https://dev.dataloy.com/ws/rest/BusinessUnit/1000576",
        "codeProperty": "businessUnitCode",
        "createdDate": "2004-04-29T19:20:03",
        "changedById": 30037916,
        "createdById": 999999,
        "externalObjectKey": null,
        "modifiedDate": "2024-10-22T08:38:11",
        "voyageCurrency": {
            "key": 400132,
            "self": "https://dev.dataloy.com/ws/rest/Currency/400132"
        },
        "businessUnitName": "Dry Bulk",
        "businessUnitCode": "DRY",
        "users": [
            {
                "key": 999999,
                "self": "https://dev.dataloy.com/ws/rest/User/999999"
            },
            {
                "key": 1046662,
                "self": "https://dev.dataloy.com/ws/rest/User/1046662"
            },
            {
                "key": 1511445,
                "self": "https://dev.dataloy.com/ws/rest/User/1511445"
            },
            {
                "key": 2351470,
                "self": "https://dev.dataloy.com/ws/rest/User/2351470"
            },
            {
                "key": 2424912,
                "self": "https://dev.dataloy.com/ws/rest/User/2424912"
            },
            {
                "key": 5992348,
                "self": "https://dev.dataloy.com/ws/rest/User/5992348"
            },
            {
                "key": 6078354,
                "self": "https://dev.dataloy.com/ws/rest/User/6078354"
            },
            {
                "key": 8321684,
                "self": "https://dev.dataloy.com/ws/rest/User/8321684"
            },
            {
                "key": 9500018,
                "self": "https://dev.dataloy.com/ws/rest/User/9500018"
            },
            {
                "key": 10016596,
                "self": "https://dev.dataloy.com/ws/rest/User/10016596"
            },
            {
                "key": 11508528,
                "self": "https://dev.dataloy.com/ws/rest/User/11508528"
            },
            {
                "key": 11603321,
                "self": "https://dev.dataloy.com/ws/rest/User/11603321"
            },
            {
                "key": 13953540,
                "self": "https://dev.dataloy.com/ws/rest/User/13953540"
            },
            {
                "key": 13953633,
                "self": "https://dev.dataloy.com/ws/rest/User/13953633"
            },
            {
                "key": 20618402,
                "self": "https://dev.dataloy.com/ws/rest/User/20618402"
            },
            {
                "key": 21635445,
                "self": "https://dev.dataloy.com/ws/rest/User/21635445"
            },
            {
                "key": 23723095,
                "self": "https://dev.dataloy.com/ws/rest/User/23723095"
            }
        ],
        "securityGroupAliases": [],
        "remarks": [],
        "isObjectActive": true
    },
    "baselineTerm": {
        "key": 1004265,
        "self": "https://dev.dataloy.com/ws/rest/BaselineTerm/1004265"
    },
    "contactInfo": [
        {
            "key": 5987711,
            "self": "https://dev.dataloy.com/ws/rest/ContactInfo/5987711"
        }
    ],
    "businessPartnerName2": null,
    "companyRegistrationNo": "987987987",
    "isInterCompany": false,
    "isTotalCommissionPayable": false,
    "maxAdvancePaymentPercent": 100,
    "rating": null,
    "ratingExpiryDate": null,
    "vatNumber": null,
    "addresses": [
        {
            "key": 5993125,
            "self": "https://dev.dataloy.com/ws/rest/Address/5993125"
        }
    ],
    "businessPartnerType": {
        "key": 1000032,
        "self": "https://dev.dataloy.com/ws/rest/BusinessPartnerType/1000032"
    },
    "companyBankAccount": null,
    "www": [
        {
            "key": 5987713,
            "self": "https://dev.dataloy.com/ws/rest/Www/5987713"
        }
    ],
    "remarks": [],
    "isObjectActive": true,
    "key": 1045574,
    "self": "https://dev.dataloy.com/ws/rest/BusinessPartner/1045574"
}

Last updated