SmugMug API
Tutorial
API Concepts
Advanced
- Optimizing response sizes
- Expanding related data
- Configuring expansions
- Rate Limits
- Method and Content Overrides
- Performance Metrics
- Multi-get
- Options requests
Live API Browser
Reference
Optimizing response sizes
When requesting an object from the API, by default, you will receive a response that contains all of the data for that object. This response will also include links to other API endpoints related to that object, and metadata about the parameters accepted by the current request method.
Various options are available which allow you to customize which parts of the response are sent, which can reduce the number of bytes your application downloads.
Summary
Name | Value | Description |
---|---|---|
_filter | A comma-separated list of data field names | Removes all data fields except the ones named |
_filteruri | A comma-separated list of URI names | Removes all URI fields except the ones named |
_shorturis | Just needs to be present | Removes metadata from Uris section |
_verbosity | 1, 2, or 3 | Controls the quantity of metadata |
If you want to use these options on expansions, you will need the advanced expansion configuration syntax.
_filter and _filteruri
A filter is a query argument that allows you to specify the fields you would like to be included in the response. The SmugMug API supports filtering on both the data fields in the response, as well as the linked URIs. This can be done by providing the query argument _filter
or _filteruri
with a comma separated list of the fields that should remain in the response. If no value is provided, all fields or URIs will be removed.
Let's look at an example of _filter
and _filteruri
in action.
Unfiltered request:
Unfiltered response:
Filtered request:
Filtered response:
_shorturis
Another option to reduce the size of your API responses is the _shorturis
option. If this parameter is present in an API request, the URI section of the response object will be trimmed down so that each entry is just a key-value pair of name to URI. This removes all metadata about the URI from the response.
Below is an example of a URIs section with and without _shorturis
.
Without _shorturis:
With _shorturis:
_verbosity
Parameter | Effect |
---|---|
_verbosity=1 | No Options section. This also implies _shorturis=, and removes a few metadata fields that appear in the Response section. |
_verbosity=2 | If the current request method has parameters, there will be an Options section listing those parameters, but the parameters of other request methods will not be included. This is the default verbosity level, except for OPTIONS requests. |
_verbosity=3 | An Options section will be included, and parameters will be listed for all request methods. This is the default verbosity level for OPTIONS requests. |