Select

Modified on Wed, 11 Mar at 12:50 PM

Purpose


  • The $select parameter allows you to specify which properties of a resource should be included in the response.


Key Points


  • You can include specific properties of any resource by listing them in the $select expression.
  • This helps reduce the amount of data returned, improving performance.
  • The properties must be specified by name and must match those defined in the metadata.


Syntax of $select Expression


  • The expression follows the format:
PROPERTY1_NAME, PROPERTY2_NAME
  • This means you can list multiple properties separated by commas.
prod_ref, prod_title


Supported Properties


  • The list of available properties for the Product resource can be found in the JSON schema returned by the /$metadata endpoints.
  • Example: When making a request to /Products/$metadata, you will get a schema detailing all available properties like prod_title, prod_ref, etc.


How to Use $select in a Request


  • When constructing your API request, add the $select parameter to specify the fields you want to retrieve.
http://api2.saleslayer.com/rest/Catalog/Products?$select=prod_ref,prod_title


Response Format


  • When you use $select, the response will only contain the specified properties, making it more concise and efficient.
{
    "value": [
        {
            "prod_ref": "MyPer",
            "prod_title": {
                "en": "My Personify"
            }
        },
        {
            "prod_ref": "CuMoApp",
            "prod_title": {
                "en": "Custom Mobile Apps"
            }
        },
        {
            "prod_ref": "Atrius",
            "prod_title": {
                "en": "Atrius"
            }
        },
        {
            "prod_ref": "Builder",
            "prod_title": {
                "en": "Builder"
            }
        },
        {
            "prod_ref": "X-pressP",
            "prod_title": {
                "en": "X-press gfx Points"
            }
        },
        {
            "prod_ref": "EC-gfx",
            "prod_title": {
                "en": "EC-gfxProgram"
            }
        },
        {
            "prod_ref": "PreApp",
            "prod_title": {
                "en": "Preloaded Applications"
            }
        },
        {
            "prod_ref": "ProdEnhanT",
            "prod_title": {
                "en": "Productivity Enhancing Tools"
            }
        },
        {
            "prod_ref": "ECx-L-4D",
            "prod_title": {
                "en": "ECx-Light-4DALI"
            }
        },
        {
            "prod_ref": "ECx-L-S",
            "prod_title": {
                "en": "ECx-Light Series"
            }
        },
        {
            "prod_ref": "ECx-B-S",
            "prod_title": {
                "en": "ECx-Blind Series"
            }
        }
    ],
    "@count": 11,
    "@readLink": "https://api2.saleslayer.com/rest/Catalog/Products?$select=[prod_ref,prod_title]"
}


Notes


  • The $select parameter is a powerful tool for reducing the size of the response, especially when you're working with large datasets.
  • You should always refer to the metadata endpoint (e.g., /Products/$metadata) to confirm which properties are available for the resources you're working with.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article