OptionResource

Overview

The InService Option web service enables you to find and validate the options available for a specific product context.

Supported API's

  • Retrieve the options and associated choices for a given context.
  • Retrieve the choices for a given context and specified options.
  • Validate free form choices for a given context and specified options.

Data Model Objects

  • SCList

Customization Points

ClassMethodDescription
com.ptc.sc.sce.services.SCEOptionService all This is the standard implementation of the Option Service(com.ptc.sc.servicecommon.OptionService) that uses E3C as the data store. This can be extended or replaced completely to use a different data store or to handle custom use cases.

Parameter Definitions

Individual end points might require different information be passed in the following parameters. Refer to the end point documentation for more information on using the query parameters.

NameDescriptionVersion
$filter This OData parameter specifies the filter criteria. You can provide multiple parameters as criteria using the $filter query parameter. For example: $filter=ContextId eq 'contextId' and Options eq 'id1,1d2' current
$orderby This OData parameter specifies how to sort the options. For example: $orderby=Name desc current
$top This OData parameter specifies the number of the results to be returned to the client. The default value for the $top parameter is configured using the InService system property com.ptc.sc.servicecommon.StandardSystemPropertyService.globalDefaultPageSize. If the $top value is not passed, the default value might be used to support pagination. current
$skip This OData parameter specifies the number of the result from which to start. If the $skip value is not passed, the default value of 0 is used. current
$expand This OData parameter specifies expanded options information such as choices. You can provide multiple expand values as comma separated values. For example: $expand = choices,descriptions current
Language This query parameter specifies the language in which you want to retrieve the option and choice labels. Language is no longer used and the preferred languages are taken from Accept-Language header parameter. current

The following resources are applicable:

Available Since
InService 6.0

GET /options

Use the Option Web service’s Options endpoint to provide a list of options and related choices for a given context. The end point can provide information for a specific set of options or for all of the options for a given context. The client can request the choices for the options.

Usage:
  • Options for a given context: http://HOST/Web Context/servlet/servicecenter/rest/options?$filter=ContextId eq 'ContextId'&Language=en
  • Specific Options for a given context: http://HOST/Web Context/servlet/servicecenter/rest/options?$filter=ContextId eq 'ContextId' and Options eq 'OptionId1,OptionId2'&Language=en
  • Options and Choices for a given context: http://HOST/Web Context/servlet/servicecenter/rest/options?$filter=ContextId eq 'ContextId'&$expand=Choices&Language=en
  • Specific Options and Choices for a given context: http://HOST/Web Context/servlet/servicecenter/rest/options?$filter=ContextId eq 'ContextId' and Options eq 'OptionId1,OptionId2'&$expand=Choices&Language=en
  • Available Since
    InService 6.0

    Request Parameters

    name type description default
    $expand query OData parameter specifying any expanded options, such as whether to include the Choices.
    Supported expand parameters are:
    • Choices: Includes the choices for the options requested in the response.
    n/a
    $filter query OData expression that represents a filter criteria to be used to retrieve the options. The currently used parameters are ContextId and Options (for example:$filter=ContextId eq 'SCId representation of ContextId' and Options eq 'OptionId1, OptionId2').
    Supported filter parameters are:
    • ContextId: The SCId representation of product context information, such as the Sales Model.
    • Options: Option codes for which the choices might have to be retrieved. If Options is not provided, then all the options for the context are returned.
    n/a
    $orderby query OData parameter specifying the sorting of the options. (for example: $orderby=Name asc). Currently, this parameter is not used by the options end point. n/a
    $skip query The number of the result from which to start. (for example : $skip = 20). Currently, this parameter is not used by the options end point. n/a
    $top query The number of the result to return. (for example: $top = 10). Currently, this parameter is not used by the options end point. n/a
    Language query Query parameter specifying the language in which to retrieve the option information. n/a

    Response Codes

    code condition
    200 Returned if the request is successful.
    400 Returned if the request provided is invalid or if the context information is not provided.
    404 Returned if options cannot be retrieved for the context.
    415 Returned if the Accept header is not properly passed.

    Response Body

    media type data type
    application/vnd.ptc.sc+json SCList (JSON)
Available Since
InService 6.0

POST /options/validate

Use the Option Web service’s Validate endpoint to check a list of options and related choices for a given context. If the options and choices provided are valid, then those are returned back to the client.

Usage:
  • Validate the provided options: http://HOST/Web Context/servlet/servicecenter/rest/options/validate?$filter=ContextId eq 'ContextId'&Language=en
  • Available Since
    InService 6.0

    Request Parameters

    name type description default
    $expand query OData parameter specifying any expanded options, such as whether to include the Choices. Currently, this parameter is not used by the validate end point. n/a
    $filter query OData expression specifying the filter criteria to be used to retrieve the options. The currently used parameter is ContextId (example: $filter= ContextId eq 'SCId representation of ContextId').
    Supported filter parameters are:
    • ContextId: The SCId representation of product context information, such as the Sales Model.
    n/a
    $orderby query OData parameter specifying the sorting of the options. (for example: $orderby=Name asc). Currently, this parameter is not used by the validate end point. n/a
    $skip query The number of the result from which to start. (for example : $skip = 20). Currently, this parameter is not used by the validate end point. n/a
    $top query The number of the result to return. (for example: $top = 10). Currently, this parameter is not used by the validate end point. n/a
    Language query Query parameter specifying the language in which to retrieve the options information. n/a

    Request Body

    media type data type description
    application/vnd.ptc.sc+json SCList (JSON) The SCList representation of the options and their related choices must be provided.

    Response Codes

    code condition
    200 Returned if the request is successful.
    400 Returned if the request provided is invalid or if the context information is not provided.
    404 Returned if options cannot be validated for the context.
    415 Returned if the Accept header is not properly passed.

    Response Body

    media type data type
    application/vnd.ptc.sc+json SCList (JSON)