Package APIs

You can use package APIs to create and manage packages in Git repositories.

GET - Get all packages

Retrieves the list of all custom packages in a specific project.

URL
../apis/v1/rest/projects/{project}/configurations/packages
Parameters
  • {project} - Name of the project.
Request headers
Content-Type: application/json
X-INSTANCE-API-KEY: <generated API key>
Request body
None
Response

{
    "output": [
        {
            "packageName": "<package name>",
            "wpmServer": "<Path of the server on which the package is hosted>",
            "wpmRegistry": "public"
        },
        {
            "packageName": "<package name>",
            "gitUrl": "<Repository path where the package is hosted>",
            "gitServerName": "<Name of the Git server>",
            "gitUserName": "<Name of the user who has access to the repository>",
            "gitBranch": "<Name of the Git branch>"
        }
    ]
}

POST - Add packages

Adds a custom package to a repository.

URL
../apis/v1/rest/projects/{project}/configurations/packages
Parameters
  • {project} - Name of the project.
Request headers
Content-Type: application/json
X-INSTANCE-API-KEY: <generated API key>
Request body
Sample custom package
{
    "packageName": "<Name of the package>",
    "gitUrl": "<Git repository path>",
    "gitServerName": "<Name of the Git server>",
    "gitUserName": "<Name of the user who has access to the repository>",
    "gitBranch": "<Name of the Git branch>"
}
Note: If the specified branch is incorrect, the API does not fail the operation. Instead, it pulls configuration from the current default branch (HEAD) of the Git provider.
Response
If the request is successful, the HTTP 201 Added status response code is displayed.

PUT - Update packages

Updates a specific package in the repository.

URL
../apis/v1/rest/projects/{project}/configurations/packages
Parameters
  • {project} - Name of the project.
Request headers
Content-Type: application/json
X-INSTANCE-API-KEY: <generated API key>
Request body
{
    "projectPackageName": "<Name of the project>",
    "name": "<Name of the package>",
    "gitServerName": "<Name of the Git server>",
    "gitBranch":"<Name of the Git branch>"
}
Response
If the request is successful, the HTTP 200 response code is displayed.

{
  "message": "Package updated successfully."
}

DELETE - Delete packages

Deletes a specific package from the repository.

URL
../apis/v1/rest/projects/{project}/configurations/packages/{packageName}
Parameters
  • {project} - Name of the project.
  • {packageName} - Name of the package.
Request headers
Content-Type: application/json
X-INSTANCE-API-KEY: <generated API key>
Request body
None
Response
If the request is successful, the HTTP 204 No content response code is displayed.

{
  "message": "Package deleted successfully."
}