+

Search Tips   |   Advanced Search

Add query parameters - REST API

We can add query parameters as required using the following instructions.


Sorting the results

Use the query parameters orderMetric and order to sort entries of a result set.

    orderMetric
    Specify by what metric to sort the result list. Valid values depend on the model we are using:

      For the resource model:

      • RESOURCE_ID
      • RESOURCE_CREATION_DATE
      • RESOURCE_LAST_MODIFIED_DATE
      • RESOURCE_TYPE_SCHEMA
      • RESOURCE_SCHEME_SPECIFIC_PART
      • RESOURCE_URI
      • RESOURCE_TITLE

      For the tag model:

      • TAG_ID
      • TAG_CREATION_DATE
      • TAG_LAST_MODIFIED_DATE
      • TAG_LOCALE
      • TAG_NAME
      • TAG_RESOURCE_ID
      • TAG_OWNER_ID
      • TAG_SCOPE

      For the tag space model:

      • TAG_SPACE_COUNT_REVERSE_NAME. Default.
      • TAG_SPACE_NAME
      • TAG_SPACE_COUNT
      • TAG_SPACE_CREATION_DATE
      • TAG_SPACE_LAST_MODIFIED_DATE
      • TAG_SPACE_COUNT_NAME

      For the rating model:

      • RATING_ID
      • RATING_CREATION_DATE
      • RATING_LAST_MODIFIED_DATE
      • RATING_VALUE
      • RATING_RESOURCE_ID
      • RATING_OWNER_ID
      • RATING_SCOPE

      For the rating space model:

      • RATING_SPACE_VALUE
      • RATING_SPACE_COUNT
      • RATING_SPACE_CREATION_DATE
      • RATING_SPACE_LAST_MODIFIED_DATE

    order=ASC|DESC
    Specify whether to sort in ascending or descending order. Valid values are ASC and DESC.

Example:

    tm:ts:all&orderMetric=TAG_SPACE_COUNT_NAME&order=ASC

This returns a feed containing all available tag spaces, that is all available tags and their names and counts. The results are sorted in ascending order, first by tag count, and, if counts are equal, by tags name.


Limiting the results

Use the query parameters start-index and max-results to limit the query results in the feed to a subset.

    start-index
    First item from the overall result set to have returned.

    max-results
    Specify how many additional items after the start item to have returned.

Examples:

    • uri=tos:typeahead&term=A&max-results=10

    This example returns a feed containing at the most the first 10 elements of the result.

    • uri=tos:typeahead&term=A&start-index=20&max-results=10

    This example returns a feed containing at the most 10 elements, starting with the 20th element from the result.

    • tm:name:tag_name&start-index=5&max-results=5

    This example returns a feed containing 5 tag entries of the overall result set that match the name tag_name, leaving out the first four results, and returning the following 5 tag entries.


Use scopes

Users can apply both tags and ratings as community tags or personal tags, either public or private. For details refer to the topic about how tagging and rating works in the portal. To control whether you query only community or personal tags or ratings, or both types of tags or ratings, use the parameter scope. Valid values are as follows:

    For tagging:

      COMMUNITY
      Return only community tags.

      PERSONAL_PRIVATE
      Return only personal private tags.

      PERSONAL_PUBLIC
      Return only personal public tags.

      PERSONAL
      Return all personal tags, both public and private. This has the same effect as using the scope parameter with both values PERSONAL_PRIVATE and PERSONAL_PUBLIC .

      ALL
      Return all tags, community tags, and personal public and private tags. This has the same effect as using the scope parameter with multiple values PERSONAL_PRIVATE , PERSONAL_PUBLIC, and COMMUNITY .

    Valid combinations of values are as follows:

    • COMMUNITY and PERSONAL
    • COMMUNITY and PERSONAL_PRIVATE
    • COMMUNITY and PERSONAL_PUBLIC
    • COMMUNITY and PERSONAL_PUBLIC and PERSONAL_PRIVATE
    • PERSONAL_PUBLIC and PERSONAL_PRIVATE

    For rating:

      COMMUNITY
      Return only community ratings.

      PERSONAL_PRIVATE
      Return only personal private ratings.

      PERSONAL_PUBLIC
      Return only personal public ratings.

      PERSONAL
      Return all personal ratings, both public and private. This has the same effect as using the scope parameter with both values PERSONAL_PRIVATE and PERSONAL_PUBLIC .

      ALL
      Return all ratings, community ratings, and personal public and private ratings. This has the same effect as using the scope parameter with multiple values PERSONAL_PRIVATE , PERSONAL_PUBLIC, and COMMUNITY .

    Valid combinations of values are as follows:

    • COMMUNITY and PERSONAL
    • COMMUNITY and PERSONAL_PRIVATE
    • COMMUNITY and PERSONAL_PUBLIC
    • COMMUNITY and PERSONAL_PUBLIC and PERSONAL_PRIVATE
    • PERSONAL_PUBLIC and PERSONAL_PRIVATE

Example:

    tm:ts:all&scope=COMMUNITY&scope=PERSONAL_PUBLIC

This returns a feed containing all available tag spaces with community tags and the public tags of the current user.


Locale sensitive queries

We can specify to search only a specific locale or set of locales. This can be useful when we work with URIs that address tags by their name locales. To do this, use the parameter locale. Examples:

    tm:name:tag_name&locale=de

This returns a feed containing all tags that match the name tag_name in the locale de.

    tm:name:tag_name&locale=de&locale=en

This returns a feed containing all tags that match the name tag_name in the locale de or en.


Parent The REST API

Related concepts:

Introduction to tagging and rating

Related reference:

Normalizing tags
How tagging and rating works in the portal
Grouping tags and ratings via resource categorization
How public and private tags and ratings work in the portal