Global Organization/Product/Project API

Overview

Generally, each level of the administrator (Global Org, Organization, Product, Project) can get or set the API attributes in the API calls that refer to their scope or are under their scope. For example, Product administrators can execute API calls related to their Projects/Products that are defined in Mend Application, but they cannot execute Organization-related API calls which are outside their scope.

This document showcases the API requests and responses for:

  • Creating global organizations, assigning them to organizations, or removing them from organizations

  • Getting all organizations and their details

  • Getting all products and their vitals at the organization-level

  • Getting all projects and their vitals at the organization and product-level

  • Change the assignment of projects between products

  • Changing the owner for all policies in an organization

  • Getting In-House libraries at the organization, product and project-level

  • Unmarking libraries that were manually assigned as In-House, at the organization level

Global Organization Level APIs

NOTE: Global Organization Level APIs can be accessed only by users with Site Admin privileges in On-Premise environments.

The following APIs describe how to create global organizations, assign them to organizations, or remove them from organizations.

Create Global Organization

This API request creates a global organization with an API key token which is its unique identifier.

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type that creates a global organization.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in mend.stringYes
nameName to be assigned to the global organization.stringYes
accountAdminEmailEmail account of the Administrator that is creating the global organization.stringYes

Request Example

{
   "requestType": "createGlobalOrg",
   "userKey": "user_key",
   "name": "global_org_name",
   "accountAdminEmail": "enter_account_admin_email@here.com"
}

Response Example

The Response returns the token key that uniquely identifies the global organization.

{
   "globalOrgToken": "global_org_token"
}

Assign Global Organization to an Organization

This API request assigns a global organization to an organization.

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type that assigns a global organization to an organization.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in mend.stringYes
orgTokenAPI key which is the unique identifier of the organization. Admins can find this token in the "Integrate" tab of the application, in the "API Key" field.stringYes
globalOrgTokenAPI token key which identifies the global organization to be assigned.stringYes

Request Example

{
   "requestType": "assignGlobalOrgToOrg",
   "userKey": "user_key",
   "orgToken": "organization_api_key",
   "globalOrgToken": "global_org_token"
}

Response Example

"message":"Successfully assigned global organization to given organization"

Remove Global Organization from an Organization

This API request removes a global organization from an organization.

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type that removes a global organization from an organization.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in mend.stringYes
orgTokenAPI key which is the unique identifier of the organization. Admins can find this token in the "Integrate" tab of the application, in the "API Key" field.stringYes
globalOrgTokenAPI token key which identifies the global organization to be removed.stringYes

Request Example

{
   "requestType": "removeGlobalOrgFromOrg",
   "userKey": "user_key",
   "orgToken": "organization_api_key",
   "globalOrgToken": "global_org_token"
}

Response Example

"message":"Successfully removed global organization from given organization"

Organization Level APIs

Get Organizations

This API request returns data on all organizations within the Global Organization.

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type that returns the name and token ID of all the organizations in a global organization.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in mend.stringYes
globalOrgTokenAPI token key which uniquely identifies the global organization.stringYes

Request Example

{
  "requestType":"getAllOrganizations",
  "userKey": "user_key", 
  "globalOrgToken":"global_organization_token"
}

Response Example

{
    "organizations": [
        {
            "orgName": "Org A",
            "orgToken": "Org_a_token"
        },
        {
            "orgName": "Org B",
            "orgToken": "Org_b_token"
        }
    ],
    "message": "Success"
}

Get Organization Details

This API request returns details about an organization, such as, name, token key, creation date, number of products, projects, groups, and users in the organization.

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type that returns the details of an organization.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in mend.stringYes
orgTokenAPI token key which uniquely identifies the organization.stringYes

Request Example

{
"requestType":"getOrganizationDetails",
"orgToken":"organization_api_key",
“userKey”:”user_key”
}

Response Example

{
"orgName": "Org A",
"orgToken": "Org_a_token",
"creationDate": "2016-01-01 12:00:00",
"numberOfProducts": "15",
"numberOfProjects": "105",
"numberOfGroups": "2",
"numberOfUsers": "3"
}

Product Level APIs

Get Products

This API request gets all products in the organization; name and token of each.

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type that returns all the products in an organization.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in mend.stringYes
orgTokenAPI token key which uniquely identifies the organization.stringYes

Request Example

{
  "requestType":"getAllProducts",
  "userKey": "user_key", 
  "orgToken":"org_token"
}

Response Example

{
    "products": [
        {
            "productName": "Product A",
            "productToken": "product_a_token"
        },
        {
            "productName": "Product B",
            "productToken": "product_b_token"
        }
    ],
    "message": "Success"
}

Get Organization Product Vitals

This API request gets basic information about each product in an organization: ID, name, token, creation date and last updated date.

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type that returns the vitals of all products in an organization.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in mend.stringYes
orgTokenAPI token key which uniquely identifies the organization.stringYes

Request Example

{
	"requestType" : "getOrganizationProductVitals",
    "userKey": "user_key", 
	"orgToken" : "organization_api_key"
}

Response Example

{
    "productVitals": [
        {
            "id": 626506,
            "name": "Demo Product",
            "token": "product_token",
            "creationDate": "2020-03-09 15:28:38 +0000",
            "lastUpdatedDate": "2020-03-10 08:46:29 +0000"
        },
        {
            "id": 626507,
            "name": "Cfy",
            "token": "product_token",
            "creationDate": "2020-03-09 15:29:11 +0000",
            "lastUpdatedDate": "2020-03-10 08:18:37 +0000"
        },
        {
            "id": 626930,
            "name": "Rx",
            "token": "product_token",
            "creationDate": "2020-03-10 07:29:45 +0000",
            "lastUpdatedDate": "2020-03-10 14:59:55 +0000"
        },

Project Level APIs

Get Projects

This API request receives a product token and returns all the projects in the specified product; name and token of each.

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type that returns data of all the projects in a product.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in mend.stringYes
productTokenAPI token key which uniquely identifies the product.stringYes

Request Example

{
  "requestType":"getAllProjects",
  "userKey": "user_key", 
  "productToken":"product_token"
}

Response Example

{
    "projects": [
        {
            "projectName": "project_a",
            "projectToken": "project_a_token"
        },
        {
            "projectName": "project_b",
            "projectToken": "project_b_token"
        }
    ],
    "message": "Success"
}

Get Organization Project Vitals

This API request gets basic information about each project in an organization: ID, name, token, creation date and last updated date.

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type that returns the vitals of all projects in an organization.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in mend.stringYes
orgTokenAPI token key which uniquely identifies the organization.stringYes

Request Example

{
	"requestType" : "getOrganizationProjectVitals",
     "userKey": "user_key", 
	"orgToken" : "organization_api_key"
}

Response Example

{
    "projectVitals": [
        {
            "id": 2036041,
            "name": "Demo Data",
            "token": "org_token",
            "creationDate": "2020-03-09 15:28:38 +0000",
            "lastUpdatedDate": "2020-03-09 15:28:38 +0000"
        },
       {
            "id": 2036049,
            "name": "cfy-1",
            "token": "org_token",
            "creationDate": "2020-03-09 15:29:49 +0000",
            "lastUpdatedDate": "2020-03-09 15:29:49 +0000"
        },
          ..........

Get Product Project Vitals

This API request gets basic information about each project in a product: ID, name, token, creation date and last updated date.

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type that returns the vitals of all projects in a product.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in mend.stringYes
productTokenAPI token key which uniquely identifies the product.stringYes

Request Example

{
	"requestType" : "getProductProjectVitals",
    "userKey": "user_key", 
	"productToken" : "product_token"
}

Response Example

{
    "projectVitals": [
        {
            "pluginName": "unified agent",
            "pluginVersion": "20.2.1",
            "id": 2038527,
            "name": "my-proj",
            "token": "product_token",
            "creationDate": "2020-03-10 08:33:25 +0000",
            "lastUpdatedDate": "2020-03-10 08:34:38 +0000"
        }
    ]
}

Get Project Vitals

This API request gets basic information about each project in an organization: ID, name, token, creation date and last updated date.

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type that returns the vitals of a project.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in mend.stringYes
projectTokenAPI token key which uniquely identifies the project.stringYes

Request Example

{
	"requestType" : "getProjectVitals",
    "userKey": "user_key", 
	"projectToken" : "project_token"
}

Response Example

{
    "projectVitals":[
        {
            "pluginName":"fs-agent",
            "pluginVersion": "18.2.2",
            "name": "My Project",
            "token": "project_token",
            "uploadedBy": "name_of_user_who_ran_scan",
            "creationDate": "2016-01-01 12:00:00",
            "lastUpdatedDate": "2016-02-02 16:50:59"
        }
    ]
}

Change Project Assignment

This API request allows you to move projects that are assigned to a particular product and assign them to another product.

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type that changes the project assignment.stringYes
orgtokenAPI token key which uniquely identifies the organization.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in Mend.stringYes
projectTokenAPI token key which uniquely identifies the project to be reassigned.stringYes
newProductTokenAPI token key which uniquely identifies the product to which the project will be reassigned.stringYes

Request Example

{
    "requestType": "changeProjectAssignment",
    "orgToken": "{{orgToken}}",
    "userKey": "{{userKey}}",
    "projectToken": "{{projectToken}}",
    "newProductToken": "{{productToken}}"
}

Response

{
    "message": "Project assigned successfully to the new product"
}

Change Policy Owner

This API finds all the policies that were created by the user with the email specified in "currentPolicyOwnerEmail", and reassigns them to the user with the email specified in "newPolicyOwnerEmail".

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type that changes the policy owner for all policies in an organization.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in mend.stringYes
orgTokenAPI token key which uniquely identifies the organization.stringYes
currentPolicyOwnerEmailEmail address of current policy owner.stringYes
newPolicyOwnerEmailEmail address of new policy owner for the organization.stringYes

Request Example

{
  "requestType":"changeOrganizationPolicyOwner",
  "userKey": "user_key", 
  "orgToken":"organization_api_key",
  "currentPolicyOwnerEmail":"Owner.email@mendsoftware.com",
  "newPolicyOwnerEmail" : "newOwner.email@mendsoftware.com"
}

Response

{
    "message": "Successfully changed policy owners in the organization"
}

Get In-House Libraries

This API request gets information about In-House libraries for an organization, product, or project.

Notes about the Response Parameters:

  • matchType parameter value shows “manual” if it is manually marked by user, or “automatic” if it is automatically marked by an In-House rule.

  • pattern parameter is not returned for a library if the matchType value is “manual”.

  • comment parameter is not returned for a library if the matchType value is “automatic”.

Organization Level

Get all In-House libraries at the organization level.

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type that returns all In-House libraries for an organization.stringYes
orgTokenAPI key which is a unique identifier of the organization.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in mend.stringYes

Request Example

{
    "requestType" : "getOrganizationInHouseLibraries",
    "orgToken" : "organization_api_key",
    "userKey": "user_key"
}

Response Example

{
    "libraries": [
        {
            "matchType": "manual",
            "comment": "",
            "keyUuid": "library_unique_id",
            "filename": "neo4j-lucene-index-1.8.1.jar",
            "groupId": "org.neo4j",
            "artifactId": "neo4j-lucene-index",
            "sha1": "library_sha1",
            "type": "MAVEN_ARTIFACT",
            "description": "Integration layer between Neo4j and Lucene, providing one possible implementation of the Index API.",
            "productName": "Demo Product",
            "productToken": "product_token",
            "projectName": "Demo Data",
            "projectToken": "project_token"
        },
        {
            "matchType": "manual",
            "comment": "",
            "keyUuid": "library_unique_id",
            "filename": "nekohtml-1.9.6.2.jar",
            "groupId": "nekohtml",
            "artifactId": "nekohtml",
            "sha1": "library_sha1",
            "type": "MAVEN_ARTIFACT",
            "productName": "Demo Product",
            "productToken": "product_token",
            "projectName": "Demo Data",
            "projectToken": "project_token"
        }
    ]
}

Product Level

Get all In-House libraries at the product level.

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type that returns all In-House libraries for a product.stringYes
productTokenUnique identifier of the product.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in mend.stringYes

Request Example

{
    "requestType" : "getProductInHouseLibraries",
    "productToken" : "product_token",
    "userKey": "user_key"
}

Response Example

{
    "libraries": [
        {
            "matchType": "manual",
            "comment": "",
            "keyUuid": "library_unique_id",
            "filename": "neo4j-lucene-index-1.8.1.jar",
            "groupId": "org.neo4j",
            "artifactId": "neo4j-lucene-index",
            "sha1": "library_sha1",
            "type": "MAVEN_ARTIFACT",
            "description": "Integration layer between Neo4j and Lucene, providing one possible implementation of the Index API.",
            "productName": "Demo Product",
            "productToken": "product_token",
            "projectName": "Demo Data",
            "projectToken": "project_token"
        },
        .........
    ]
}

Project Level

Get all In-House libraries at the project level.

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type that returns all In-House libraries for a project.stringYes
projectTokenUnique identifier of the project.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in mend.stringYes

Request Example

{
    "requestType" : "getProjectInHouseLibraries",
    "projectToken" : "project_token",
    "userKey": "user_key"
}

Response Example

"libraries" : [
    {
        "matchType" : "manual",
        "comment": "manually set to In-House",
        "keyUuid": "library_unique_id",
        "filename": "library_file_name",
        "groupId": "library_group_id",
        "artifactId": "library_artifact_id",
        "version": "library_version",
        "sha1": "library_sha1",
        "type": "library_type",
        "description": "library_description",
        "productName" : "product_name",
        "productToken" : "product_token",
        "projectName" : "project_name",
        "projectToken" : "project_token" 
    },
    {
        "matchType" : "automatic",
        "pattern" : "common-*",
        "keyUuid": "library_unique_id",
        "filename": "library_file_name",
        "groupId": "library_group_id",
        "artifactId": "library_artifact_id",
        "version": "library_version",
        "sha1": "library_sha1",
        "type": "library_type",
        "description": "library_description",
        "productName" : "product_name",
        "productToken" : "product_token",
        "projectName" : "project_name",
        "projectToken" : "project_token  
    }
]

Unmark In-House Libraries

This API request enables you to unmark libraries that were manually assigned as In-House. This request is only at the organization level.

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type that unmarks a library that was manually assigned as In-House, at the organization level.stringYes
orgTokenAPI key which is a unique identifier of the organization.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in mend.stringYes
keyUuidThe ID of the library which uniquely identifies it.stringYes

Request Example

{
    "requestType": "unmarkManualInHouseLibrary",
    "userKey": "user_key",
    "orgToken": "organization_api_key",
    "keyUuid" : "library_UUID"
}

Response Example

{
    "message": "Successfully unmarked in-house library"
}

Manage Pending Tasks

Theses APIs retrieve a list of all Pending Tasks in a domain and allow them to be deleted one by one.

Get Pending Tasks in a Domain

This API requests a list of all Pending Tasks in a domain.

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type that returns all Pending Tasks in the domain.stringYes
orgTokenAPI key which is a unique identifier of the organization.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in Mend.stringYes
pageThe page number from which to start listing the pending tasks. The default is 0.integerNo
pageSizeThe number of pending tasks to be included in the page; permitted values are in the range 1-10,000integerNo

Request Example

{
    "requestType":"getDomainPendingTasks",
	"orgToken": "organization_api_key",
	"userKey": "user_key",
	"page": 0,
	"pageSize": 1000
}

Response Example

{
    "pendingTaskInfos": [
        {
            "uuid": "dd63bdb4-2a46-40db-a4a8-c894988a99fc",
            "productName": "red",
            "projectName": "redeb - 13",
            "artifact": "libudev1_245.4-4ubuntu3.13_amd64.deb",
            "sha1": "83dc945b8b471c42ee9037cace6801dbb904f0fe",
            "creationTime": "2022-04-18 10:28:18",
            "approverEmail": "hasan.mosa@mendsoftware.com"
        },
        {
            "uuid": "e5ee86b7-5c5a-4aa1-a90d-ed59746a719e",
            "productName": "Test_Product",
            "projectName": "G_Project",
            "artifact": "ecrcustomerisv2-cloud-config-03.00.00.71-SNAPSHOT.jar",
            "sha1": "f82138e1d2823fd0be5cbfafcceefaae70eaf4fe",
            "creationTime": "2022-04-06 10:59:06",
            "approverEmail": "hasan.mosa@mendsoftware.com"
        }
    ]
}

Delete Pending Tasks in a Domain

This API request deletes a single Pending Task in a domain with a given UUID.

QUERY PARAMETERS

ParameterDescriptionTypeRequired
requestTypeAPI request type for deleting a Pending Task.stringYes
orgTokenAPI key which is a unique identifier of the organization.stringYes
userKeyThe ID of the user’s profile, which uniquely identifies the user in mend.stringYes
taskUUIDA uuid for one of the Pending Tasks that was returned by the getDomainPendingTasks API.stringYes

Request Example

{
    "requestType":"closePendingTask",
	"orgToken": "organization_api_key",
	"userKey": "user_key",
	"taskUUID": "e5ee86b7-5c5a-4aa1-a90d-ed59746a719e"
}

Response Example

{
    "message": "Pending task closed successfully" / "Pending task not closed"
}