Getting started with Mend’s Container Image API 2.0
Overview
Mend's Container Image REST-compliant API 2.0 enables the automation of workflows. The API features:
Access for any user with Mend credentials, via a user key that is available on the user's profile page in the Mend Application.
Added scalability with support for pagination, filtering, and sorting search results.
Broader functionality is available programmatically.
Standardized API documentation for easy navigation and search.
Getting it done
Prerequisites before using Container Image API 2.0
The easiest way to get started with the Container Image API 2.0 is to use it inside an API platform tool. We offer deep-dive tool scenarios and usage examples in our Knowledge Base here:
Mend Container Image API 2.0 implementation examples
Log in to Container Image API 2.0
Since the Cloud Native Application is tied to your SCA organization, you must log into the organization with a valid user using the Mend SCA API 2.0 “Login” endpoint first to use the Mend Container Image API 2.0.
The credentials you will need for the SCA “Login” endpoint are:
Your email address associated with your Mend user (Mend SCA Application → Profile → Identity)
Your Mend user key (Mend SCA Application → Profile → User Keys)
Your organization token (Mend SCA Application → Integrate → Organization → API Key)
Run Container Image API 2.0
As there are many examples of using Container Image API 2.0, let’s look at the typical workflow:
Identify your URL:
For SCA API 2.0 endpoints:
https://api-<your-instance>
For Container Image API endpoints:
https://api-<your-instance>/cn/api/v2.0
Using the SCA API 2.0 URL, log in to your organization via the SCA “Login” endpoint. This will provide you with your JWT token and the orgUUID for that organization.
The JWT token (authentication) and orgUUID are required when using any of the Container Image API 2.0 endpoints.
Continuing to use the SCA API URL, you can also run the SCA “Get User Organizations” endpoint to obtain the list of Organizations and orgUUIDs of which you are a member.
Switch to the Container Image API URL and explore the multiple endpoints offered: Mend Container Image REST API 2.0.
Reference
Mend Container Image API 2.0 - URL Quick Access
For a quick view of all of the URLs for the Mend Container Image API, please review the table provided below and use the URL relevant to your Mend Application:
Mend Application Instance | Mend Container Image API URL |
---|---|
App |
|
App-EU | WhiteSource only: |
Dedicated Instance (DI) |
|
SaaS |
|
SaaS-EU |
|
Mend Container Image API 2.0 - Pagination and Sorting for Large Results
For large results, Mend Container Image API’s scalability allows for:
Pagination by default at every 50 results, where the first page is page 0. You can change the size of the page by editing
size
and specifying the page number to retrieve using thepage
. The maximum value forsize
is 1,000.Filter the results with the
search
parameter to reduce the large results set to gain even greater efficiencies. The documentation of each endpoint describes the fields which can be filtered.Sort by different fields in the results using the
sort
parameter, so that your desired item is higher up the list, saving time and resources when automating tasks. The documentation of each endpoint describes the fields which can be filtered.