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/vnd.php.serialized PHP's serialize function
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.


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