Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.

  1. 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 } } } } " }

  1. 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 } } }

  1. 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 } }

  1. 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:

  1. 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
    colourBlue
    titleRequired

Returns:

Example:

Code Block
languagegraphql
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
    colourBlue
    titleRequired

Returns:

  • [Bundle] - An array of bundles.

Example:

Code Block
languagegraphql
query {
  bundles(projectId: "10000") {
    id
    name
    projectId
    startDate
    releaseDate
    versionId
    description
    archived
    children {
      componentVersionId
    }
    released
  }
}

...

bundlesWithinDateRange

Fetches all bundles within a specified date range for a given project.

Arguments:

  • startDate: String! - The start date of the range.

    Status
    colourBlue
    titleRequired

  • endDate: String! - The end date of the range.

    Status
    colourBlue
    titleRequired

  • projectId: String! - The unique identifier of the project.

    Status
    colourBlue
    titleRequired

Returns:

  • [Bundle] - An array of bundles.

Example:

Code Block
languagegraphql
query {
  bundlesWithinDateRange(
    startDate: "2024-01-01"
    endDate: "2024-12-31"
    projectId: "10000"
  ) {
    id
    name
    projectId
    startDate
    releaseDate
    versionId
    description
    archived
    children {
      componentVersionId
    }
    released
  }
}

...

Mutation

saveBundle

Saves a new bundle or updates an existing one.

Arguments:

  • newBundle: InputBundle! - The input data for the bundle.

    Status
    colourBlue
    titleRequired

  • oldBundleId: String - The unique identifier of the existing bundle to update.

Returns:

  • Bundle - The saved or updated bundle.

Example:

Code Block
languagegraphql
mutation {
  saveBundle(
    newBundle: {
      id: "bundle-10004-9e93307c-12ab-4a6a-9119-e427f0f1e04e",
      name: "New Bundle",
      projectId: "proj123",
      startDate: "2024-01-01",
      releaseDate: "2024-06-01",
      versionId: "v1.0",
      archived: false,
      description: "Initial bundle",
      children: [{ componentVersionId: "compVersion-10000-10000-10000" }],
      released: true
    },
    oldBundleId: "bundle-10004-9e93307c-12ab-4a6a-9119-e427f0f1e04e"
  ) {
    id
    name
    projectId
    startDate
    releaseDate
    versionId
    description
    archived
    children {
      componentVersionId
    }
    released
  }
}

...

addComponentVersionToBundle

Adds a component version to an existing bundle.

Arguments:

  • bundle: SaveCVBundleInput! - The bundle data.

    Status
    colourBlue
    titleRequired

  • newComponentVersionId: String! - The ID of the new component version to add.

    Status
    colourBlue
    titleRequired

  • oldComponentVersionId: String - The ID of the old component version to replace.

Returns:

Example:

Code Block
languagegraphql
mutation {
  addComponentVersionToBundle(
    bundle: {
      id: "bundle-10004-9e93307c-12ab-4a6a-9119-e427f0f1e04e",
      name: "Updated Bundle",
      projectId: "proj123",
      startDate: "2024-01-01",
      releaseDate: "2024-06-01",
      versionId: "v1.0",
      archived: false,
      children: [{ componentVersionId: "compVersion-10000-10000-10000" }],
      released: true
    },
    newComponentVersionId: "compVersion-10001-10001-10001",
    oldComponentVersionId: "compVersion-10000-10000-10000"
  ) {
    id
    name
    projectId
    startDate
    releaseDate
    versionId
    description
    archived
    children {
      componentVersionId
    }
    released
  }
}

...

deleteBundle

Deletes a specific bundle by its ID.

Arguments:

  • id: String! - The unique identifier of the bundle.

    Status
    colourBlue
    titleRequired

Returns:

  • String! - A message indicating the result of the deletion.

Example:

Code Block
languagegraphql
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
    colourBlue
    titleRequired

  • componentVersionId: String! - The unique identifier of the component version to delete.

    Status
    colourBlue
    titleRequired

Returns:

  • String! - A message indicating the result of the deletion.

Example:

Code Block
languagegraphql
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.

  • children: [ComponentVersionBundle] - The component versions included in the bundle.

  • 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
    colourBlue
    titleRequired

  • projectId: String! - The unique identifier of the project.

    Status
    colourBlue
    titleRequired

  • archived: Boolean! - Indicates if the bundle is archived.

    Status
    colourBlue
    titleRequired

  • released: Boolean! - Indicates if the bundle is released.

    Status
    colourBlue
    titleRequired

  • startDate: String - The start date of the bundle.

  • releaseDate: String - The release date of the bundle.

  • versionId: String - The version identifier of the bundle

  • description: String - A description of the bundle.

  • children: [ComponentVersionBundleInput] - The component versions included in the bundle.

...

SaveCVBundleInput

Input type for adding a component version to a bundle.

Fields:

  • id: String! - The unique identifier of the bundle.

    Status
    colourBlue
    titleRequired

  • name: String! - The name of the bundle.

    Status
    colourBlue
    titleRequired

  • projectId: String! - The unique identifier of the project.

    Status
    colourBlue
    titleRequired

  • released: Boolean! - Indicates if the bundle is released.

    Status
    colourBlue
    titleRequired

  • archived: Boolean! - Indicates if the bundle is archived.

    Status
    colourBlue
    titleRequired

  • startDate: String - The start date of the bundle.

  • releaseDate: String - The release date of the bundle.

  • versionId: String - The version identifier of the bundle.

  • children: [ComponentVersionUIInput]- The component versions included in the bundle.

...

ComponentVersionUIInput

Input type for specifying a component version within a bundle.

Fields:

  • projectId: String! - The unique identifier of the project.

    Status
    colourBlue
    titleRequired

  • versionId: String! - The unique identifier of the version.

    Status
    colourBlue
    titleRequired

  • componentId: String! - The unique identifier of the component.

    Status
    colourBlue
    titleRequired

...

ComponentVersionBundleInput

Input type for specifying a component version within a bundle.

Fields:

  • componentVersionId: String! - The unique identifier of the component version.

    Status
    colourBlue
    titleRequired