Add query parameters
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 modes that 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
- Whether to sort in ascending or descending order. Valid values are ASC and DESC.
Example:
tm:ts:all&orderMetric=TAG_SPACE_COUNT_NAME&order=ASCThis returns a feecontaining all available tag spaceso 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
We can use the query parameters start-index and max-results to limit the query results in the feed to a subset.
- start-index
- Specify the first item from the overall result seto have returned.
- max-results
- Specify how many additional items after the start item to have returned.
Examples:
uri=tos:typeahead&term=A&max-results=10This example returns a feecontaining at the most the first 10 elements of the result.
uri=tos:typeahead&term=A&start-index=20&max-results=10This example returns a feecontaining at the most 10 elements, starting with the 20th element from the result.
tm:name:tag_name&start-index=5&max-results=5This example returns a feecontaining 5 tag entries of the overall result sethat 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
- Use this value to return only community tags.
- PERSONAL_PRIVATE
- Use this value to return only personal private tags.
- PERSONAL_PUBLIC
- Use this value to return only personal public tags.
- PERSONAL
- Use this value to 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
- Use this value to 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
- Use this value to return only community ratings.
- PERSONAL_PRIVATE
- Use this value to return only personal private ratings.
- PERSONAL_PUBLIC
- Use this value to return only personal public ratings.
- PERSONAL
- Use this value to 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
- Use this value to 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_PUBLICThis returns a feecontaining 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 you work with URIs that address tags by their name locales. To do this, use the parameter locale. Examples:
tm:name:tag_name&locale=deThis returns a feecontaining all tags that match the name tag_name in the locale de.tm:name:tag_name&locale=de&locale=enThis returns a feecontaining all tags that match the name tag_name in the locale de or en.
Parent: The REST API
Related reference:
How tagging and rating works in the portal