Making changes with POST, PATCH, and DELETE

You may want your application to do more than just show data from SmugMug: you may want to change some! In that case, you will need to make API requests using methods other than GET.

The SmugMug API uses four methods for making changes:

Method Purpose Examples
PATCH For editing the data fields of an existing object Changing privacy settings on albums and folders
POST For creating new objects, and for changes that aren't as simple as directly editing a data field Creating albums and folders; rotating and cropping images; move images between galleries
DELETE For deleting objects

Sending data

When you PATCH or POST, you will almost certainly need to include some key-value pairs to indicate the changes you want to make. These should be put into the body of the HTTP request, and the encoding used should be sent in the Content-Type header. For example, to send input as JSON:

400: Invalid request

Supported input types

MIME Type Notes
application/x-www-form-urlencoded Defined by HTML
multipart/form-data RFC 7578

Learning more

When you visit an endpoint in your web browser, the Live API Browser will show you all the possible request methods, and the parameters they require. You can even fill in a form on the webpage and click a button to preview or submit the request! This is obviously not meant for applications to use, but it's a great way to learn the details of what data values are expected for a request.