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
Method and Content Overrides
There are certain critical aspects of the HTTP request which you may not be able to control if your code is operating in a constrained environment, such as behind an ill-behaved proxy or in certain web browsers. The SmugMug API allows for those aspects of the HTTP request to be overriden by query parameters in the URL, which are less likely to be restricted by the environment.
Overriding the Accept
header
Most endpoints can return their response in a variety of formats. You can
request a particular format using the standard HTTP Accept
header. However,
if you cannot set the Accept
header, you can request a response format using
the _accept
query parameter instead.
Both the Accept
header and _accept
parameter can include a list of
acceptable formats with different priorities. See RFC 2616 Section
14.1 for documentation of this syntax.
Supported response types
MIME Type | Notes |
---|---|
application/json | json.org |
application/vnd.php.serialized | PHP's serialize function |
application/x-msgpack | msgpack.org |
text/html | This is the Live API Browser, and should not be used by applications. |
Getting human-readable JSON with _pretty
The default serialization of JSON contains no whitespace (outside of string
literals), which can be difficult for a human to read. Add the _pretty=
query parameter to get nicely-formatted JSON for easier reading. The parameter
just has to be present; it does not need a value.
Overriding the request method
The _method=
query parameter overrides the method specified in the HTTP
request.
To ensure that HTTP caches do not improperly cache a PATCH
or
DELETE
response, you can only override to those methods when the HTTP method
is POST
.
Summary
Parameter Name | Parameter Value | Description |
---|---|---|
_accept | A supported mime type | Overrides the HTTP Accept header in the request |
_pretty | Just needs to be present | Get a human-readable JSON response |
_method | A method supported by the endpoint | Overrides the HTTP request method |