Use the REST APIs to Test Ranking Policy

You'll want to test your ranking policy to make sure it has the desired affect on search results. You can test ranking policies using the REST APIs in the following ways:
  • Draft: When a ranking policy is in a draft state you can test it using the following method:

    • rankBy parameter: Submit a search query to the Items endpoint of the REST API for Content Preview, specifying the ranking policy by name in the rankBy parameter.

      Use the following syntax:

      GET: https://instanceName-accountName.cec.ocp.oraclecloud.com/content/preview/api/v1.1/items?q=(type eq "TypeName")&rankBy=RankingPolicyName

      For example:

      GET: http://myinstance-myaccount.cec.ocp.oraclecloud.com/content/preview/api/v1.1/items?q=(type eq "Blog")&rankBy=BoostPolicy

  • Promoted: When a ranking policy is promoted you can test it using the previous method and the following additional methods:
    • rankBy parameter: When a ranking policy is promoted, you can use the rankBy parameter in the REST API for Content Preview or in the REST API for Content Management. Using similar syntax to that shown above, submit a search query to the Items Search endpoint in the REST API for Content Management, replacing preview with management.

    • Channel default search: After assigning the ranking policy as a channel default, you can pass the ChannelToken in the search query. The following channel default search example is for the REST API for Content Management, but you can also test the channel default in the REST API for Content Preview.

      Use the following syntax:

      GET: https://instanceName-accountName.cec.ocp.oraclecloud.com/content/management/api/v1.1/items?q=(type eq "TypeName")&channelToken=ChannelTokenValue

      For example:

      GET: http://myinstance-myaccount.cec.ocp.oraclecloud.com/content/management/api/v1.1/items?q=(type eq "Blog")&channelToken=MarketingChannel

  • Published: When a ranking policy is published you can test it using the previous methods and the following additional methods:
    • rankBy parameter: When a ranking policy is published, you can use the rankBy parameter in the REST API for Content Preview, in the REST API for Content Management, or in the REST API for Content Delivery. Using similar syntax to that shown above, submit a search query to the Items endpoint in the REST API for Content Delivery, replacing preview with published.

    • Channel default search: When a ranking policy is published and you assign it as a channel default, you can search the channel in the REST API for Content Preview, in the REST API for Content Management, or in the REST API for Content Delivery. Using similar syntax to that shown above, pass the ChannelToken in the search query, replacing management with published.

    • Global default search: After assigning the ranking policy as the global default, you can test the global default by searching a channel that doesn't have a channel default. The following global default example is for the REST API for Content Delivery, but you can also test the global default in the REST API for Content Preview or the REST API for Content Management.

      Use the following syntax:

      GET: https://instanceName-accountName.cec.ocp.oraclecloud.com/content/published/api/v1.1/items?q=(type eq "TypeName")&channelToken=ChannelTokenValue

      For example:

      GET: http://myinstance-myaccount.cec.ocp.oraclecloud.com/content/published/api/v1.1/items?q=(type eq "Blog")&channelToken=MarketingChannel