Perform full text search or use parameters to programamatically query your portal for content items.
search_items(
query = NULL,
filter = NULL,
title = NULL,
description = NULL,
snippet = NULL,
tags = NULL,
owner = NULL,
orgid = NULL,
item_type = NULL,
type_keywords = NULL,
created = NULL,
modified = NULL,
categories = NULL,
category_filters = NULL,
sort_field = NULL,
sort_order = NULL,
count_fields = NULL,
count_size = NULL,
display_sublayers = FALSE,
filter_logic = "and",
bbox = NULL,
page_size = 50,
max_pages = Inf,
.progress = TRUE,
host = arc_host(),
token = arc_token()
)a data.frame.
a scalar character for free text search or a valid query string as defined by the REST API.
a scalar character. If provided all other arguments except query are ignored.
optional character vector of content item titles.
optional scalar character of text to check for.
optional character vector of tags to search for.
optional character vector of owner usernames to search for.
optional character vector of organization IDs to search for.
optional character vector of content item types. Validated with item_type().
optional character vector of content tpye keywords. Validated with item_keyword().
optional length two vector which must be coercible to a date time vector. Converted using as.POSIXct(). Returns only items within this range.
optional character vector of up to 8 organization content categories.
optional character vector of up to 3 category terms. Items that have matching categories are returned. Exclusive with categories.
optional character vector of fields to sort by. Can sort by title, created, type, owner, modified, avgrating, numratings, numcomments, numviews, and scorecompleteness.
optional string. One of either asc or desc for ascending or descending order respectively.
optional character vector of up to 3 fields to count. Must be one of c("type", "access", "contentstatus", "categories").
optional integer determines the maximum number of field values to count for each counted field in count_fields. Maximum of 200.
default FALSE. Returns feature layers inside of feature services.
default "and" must be one of c("and", "or", "not"). Determines if parameters
unimplemented.
a scalar integer between 1 and 100 indicating the number of responses per page.
the maximum number of pages to fetch. By default fetches all pages.
default TRUE. Whether to display a progress bar for requests.
default "https://www.arcgis.com". The host of your ArcGIS Portal.
an object of class httr2_token as generated by auth_code()
or related function
Search is quite nuanced and should be handled with care as you may get unexpected results.
Most arguments are passed as filter parameters to the API endpoint.
If multiple values are passed to an argument such as tags, the search will use an "OR" statement.
When multiple arguments are provided, for example tags, owner, and item_type, the search will use "AND" logic—i.e. results shown match the tags and owner and item_type.
Note: you can change this to "OR" behavior by setting filter_logic = "or"
If the filter argument is provided, all other arguments except query are ignored.
crime_items <- search_items(
query = "crime",
item_type = "Feature Service",
max_pages = 1
)
crime_items
Run the code above in your browser using DataLab