The Configuration Management Toolkit Cloud now supports GraphQL, allowing you to interact with bundles more efficiently. This guide will walk you through the process of using GraphQL to perform various operations related to bundles. Firstly you should get your webtrigger from API Tokens page.
After obtaining your web trigger URL, you can send requests with an Authorization header, which you obtain from the API Tokens page.
Fetching Bundle Information:
To retrieve detailed information about a specific bundle, you can use the getBundle
operation. Provide the bundle ID as a parameter to fetch its details, including its name, project ID, start date, release date, version ID, archived status, and the list of child component versions.
GraphQL Query:
{ "query": "{ getBundle(id: \"bundle-10001-13td6df2-ab1e-4a91-917b-c25003c9ed13\") { ok errorMessages result { name projectId startDate releaseDate versionId archived children { componentVersionId } released } } } " }
2 . Fetching Bundles by Project ID:
If you want to retrieve all bundles within a specific project, you can use the getBundles
operation. Provide the project ID as a parameter to fetch the list of bundles along with their details.
GraphQL Query:
getAllBundles -> { "query": "{ getBundles(id: \"10001\") { ok errorMessages result { key value { name projectId startDate releaseDate versionId archived children { componentVersionId } released } } } } " }
Saving a Bundle:
To save a bundle, use the saveBundle
mutation. Specify the required fields such as name, project ID, start date, release date, version ID, archived status, list of child component versions, and release status.
GraphQL Mutation:
saveBundle -> { "query": "mutation { saveBundle(newBundle: { name: \"Example Bundle\", projectId: \"10001\", startDate: \"2023-01-01\", releaseDate: \"2024-01-01\", versionId: \"10001\", archived: false, children: [{ componentVersionId: \"componentVersion-10058-10001-10001\" }], released: true } ) { ok errorMessages result { name projectId startDate releaseDate versionId archived children { componentVersionId } released } } }" }
4. Add Component Version To Bundle:
This GraphQL mutation is used to add a new component version to a specific bundle. It includes parameters such as bundle information and the identifier of the new component version to be added. When the operation is successful, the results are returned, including the relevant fields.
GraphQL Mutation:
mutation { addComponentVersionToBundle(bundle: { id: "bundle-10001-2710a2d4-92gd-4d01-9594-fafa852fe468", name: "Example Bundle", projectId: "10001", startDate: "2000-01-01", releaseDate: "2000-01-01", versionId: "10001", archived: false, children: [{ componentId: "10001", versionId: "10001", projectId: "10001" }], released: true }, newComponentVersionId: "componentVersion-10001-10001-10001" ) { ok errorMessages result { name projectId startDate releaseDate versionId archived children { componentVersionId } released } } }
Delete a Bundle:
This GraphQL mutation is used to delete a bundle with the specified ID. When executed, it will return whether the operation was successful (ok
), any error messages (errorMessages
), and the result of the deletion (result
).
mutation { deleteBundle(id: "bundle-10001-0cc217a7-3560-4ec8-a810-6a228228abfb") { ok errorMessages result } }
Delete a Component Verson From a Bundle
This GraphQL mutation is used to remove a specific component version from a bundle. It requires the ID of the bundle (bundleId
) and the ID of the component version (componentVersionId
). When executed, it will return whether the operation was successful (ok
), any error messages (errorMessages
), and the result of the deletion (result
).
mutation { deleteCVFromBundle(bundleId: "bundle-10001-fdb5017d-9142-4rd8-a7c1-e96d73df4dd8", componentVersionId: "componentVersion-10001-10001-10001") { ok errorMessages result } }
Here is the GraphQL query for retrieving bundles within a specified date range:
Fetch Bundles within the Specified Date Range
This GraphQL query retrieves bundles within the specified date range for a particular project. It includes parameters such as the project ID (projectId
), start date (startDate
), and end date (endDate
). When executed, it returns whether the operation was successful (ok
), any error messages (errorMessages
), and the list of bundles within the date range (result
).
...
Table of Contents
Overview
This document provides an overview of the GraphQL API for managing bundles within a project. It includes the available queries and mutations, as well as the types used in the API.
Schemas
Query
bundle
Fetches a specific bundle by its ID.
Arguments:
id: String!
- The unique identifier of the bundle.Status colour Blue title Required
Returns:
Example:
Code Block | ||
---|---|---|
| ||
query {
bundle(id: "bundle-10004-9e93307c-12ab-4a6a-9119-e427f0f1e04e") {
id
name
projectId
startDate
releaseDate
versionId
description
archived
children {
componentVersionId
}
released
}
} |
...
bundles
Fetches all bundles for a given project.
Arguments:
projectId: String!
- The unique identifier of the project.Status colour Blue title Required
Returns:
[Bundle] - An array of bundles.
Example:
Code Block | ||
---|---|---|
| ||
query {
bundles(projectId: "10000") {
id
name
projectId
startDate
releaseDate
versionId
description
archived
released
}
} |
...
bundlesWithinDateRange
Fetches all bundles within a specified date range for a given project.
Arguments:
startDate: String!
- The start date of the range.Status colour Blue title Required endDate: String!
- The end date of the range.Status colour Blue title Required projectId: String!
- The unique identifier of the project.Status colour Blue title Required
Returns:
[Bundle] - An array of bundles.
Example:
Code Block | ||
---|---|---|
| ||
query {
bundlesWithinDateRange(
startDate: "2024-01-01"
endDate: "2024-12-31"
projectId: "10000"
) {
id
name
projectId
startDate
releaseDate
versionId
description
archived
released
}
} |
...
Mutation
saveBundle
Saves a new bundle or updates an existing one.
Arguments:
newBundle:
InputBundle! - The input data for the bundle.Status colour Blue title Required oldBundleId: String
- The unique identifier of the existing bundle to update.
Returns:
SavedBundle - The saved or updated bundle.
Example:
Code Block | ||
---|---|---|
| ||
mutation {
saveBundle(
newBundle: {
name: "New Bundle",
projectId: "proj123",
startDate: "2024-01-01",
releaseDate: "2024-06-01",
versionId: "v1.0",
archived: false,
description: "Initial bundle",
released: true
},
oldBundleId: "bundle-10004-9e93307c-12ab-4a6a-9119-e427f0f1e04e"
) {
id
name
projectId
startDate
releaseDate
versionId
description
archived
released
}
} |
...
addComponentVersionToBundle
Adds a component version to an existing bundle.
Arguments:
bundleId:
String! - The ID of the bundle.Status colour Blue title Required newComponentVersionId: String!
- The ID of the new component version to add.Status colour Blue title Required oldComponentVersionId: String
- The ID of the old component version to replace.
Returns:
SavedBundle - The updated bundle.
Example:
Code Block | ||
---|---|---|
| ||
mutation {
addComponentVersionToBundle(
bundleId: "bundle-10004-9e93307c-12ab-4a6a-9119-e427f0f1e04e",
newComponentVersionId: "compVersion-10001-10001-10001",
oldComponentVersionId: "compVersion-10000-10000-10000"
) {
id
name
projectId
startDate
releaseDate
versionId
description
archived
released
}
} |
...
deleteBundle
Deletes a specific bundle by its ID.
Arguments:
id: String!
- The unique identifier of the bundle.Status colour Blue title Required
Returns:
String!
- A message indicating the result of the deletion.
Example:
Code Block | ||
---|---|---|
| ||
mutation {
deleteBundle(id: "bundle-10004-9e93307c-12ab-4a6a-9119-e427f0f1e04e")
} |
...
deleteCVFromBundle
Deletes a component version from a bundle.
Arguments:
bundleId: String!
- The unique identifier of the bundle.Status colour Blue title Required componentVersionId: String!
- The unique identifier of the component version to delete.Status colour Blue title Required
Returns:
String!
- A message indicating the result of the deletion.
Example:
Code Block | ||
---|---|---|
| ||
mutation {
deleteCVFromBundle(
bundleId: "bundle-10004-9e93307c-12ab-4a6a-9119-e427f0f1e04e",
componentVersionId: "compVersion-10000-10000-10000"
)
} |
...
Types
Bundle
Represents a bundle within a project.
Fields:
id: String!
- The unique identifier of the bundle.name: String!
- The name of the bundle.projectId: String!
- The unique identifier of the project.startDate: Int!
- The start date of the bundle as a timestamp.releaseDate: Int!
- The release date of the bundle as a timestamp.versionId: String
- The version identifier of the bundle.description: String
- A description of the bundle.archived: Boolean!
- Indicates if the bundle is archived.children:
[ComponentVersionBundle] - The component versions included in the bundle.released: Boolean!
- Indicates if the bundle is released.
...
SavedBundle
Represents a saved bundle within a project.
Fields:
id: String!
- The unique identifier of the bundle.name: String!
- The name of the bundle.projectId: String!
- The unique identifier of the project.startDate: String
- The start date of the bundle.releaseDate: String
- The release date of the bundle.versionId: String
- The version identifier of the bundle.archived: Boolean!
- Indicates if the bundle is archived.released: Boolean!
- Indicates if the bundle is
released.
...
ComponentVersionBundle
Represents a component version within a bundle.
Fields:
componentVersionId: String!
- The unique identifier of the component version.
...
InputBundle
Input type for saving or updating a bundle.
Fields:
id: String
- The unique identifier of the bundle.name: String!
- The name of the bundle.Status colour Blue title Required projectId: String!
- The unique identifier of the project.Status colour Blue title Required archived: Boolean!
- Indicates if the bundle is archived.Status colour Blue title Required released: Boolean!
- Indicates if the bundle is released.Status colour Blue title Required startDate: String
- The start date of the bundle.releaseDate: String
- The release date of the bundle.versionId: String
- The version identifier of the bundledescription: String
- A description of the bundle.