Getting Started with the Massless Media API
2021 July 1st
So, you've heard of the Massless Media API and want to try is as quickly as possible? Then this is the article for you! Check out our other article for more examples, but for now, let's get going.
Step 1: Create an API Key
First you'll need an API key to make some calls.
- Click the profile picture avatar at the top right of the page
- Login if you haven't already
- Click "Account" on the menu
Once you're on the Account page you'll need to generate an API key.
- Scroll down to API management
- Click "Generate API Key"
- Copy this to the clipboard
Step 2: Make an API call
There are many different ways to call a REST API like the Media API. Here we will demonstrate using the Terminal (command line) and Postman (GUI).
If you're on Mac OS X, Linux, or have Cygwin, then open the Terminal and copy this command. Make sure to replacewith your API Key from the Account page.
1curl -H "x-api-key: <your-api-key>" \2https://api.massless.io/v1/image/ml/generate/face > face.png
Execute this command to generate a face using AI and save it to. Congratulations! You've just made your first call to the Media API.
Now let's use a POST request to submit an image for processing.
1curl -H "x-api-key: <your-api-key>" \2-X POST https://api.massless.io/v1/image/filter/greyscale3--form 'file=@"face.png"' \
Postman is a very useful GUI for testing APIs that is available for Windows, Mac OS X, and Linux.
- Open Postman
- Go to File > New and select HTTP Request
- Go to "Auth"
- Select Type as "API Key"
- In the "Key" field write "x-api-key"
- In the "Value" field paste your Media API Key
- Set the verb as "GET"
- Enter request URL:
- Click "Send"
Congratulations! You've just made your first call to the Massless Media API using Postman.
Now let's submit an image for processing.
- Change the URL to:
- Click the "Body" tab
- Change the body type to "form-data"
- In the "Key" field write "file" and select "File" type
- In the "Value" click "Select Files"
- Click "Send"