Back to Gitlabhq

Conan v1 API

doc/api/packages/conan_v1.md

18.11.228.6 KB
Original Source

{{< details >}}

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated

{{< /details >}}

[!note] For Conan v2 operations, see Conan v2 API.

Use this API to interact with the Conan v1 package manager. These endpoints work for both projects and instances.

[!note] These endpoints do not adhere to the standard API authentication methods. See each route for details on how credentials are expected to be passed. Undocumented authentication methods might be removed in the future.

Generally, these endpoints are used by the Conan 1 package manager client and are not meant for manual consumption.

[!warning] The Conan registry is not FIPS compliant and is disabled when FIPS mode is enabled. These endpoints all return 404 Not Found.

Create an authentication token

Creates a JSON Web Token (JWT) for use as a Bearer header in other requests to the Conan package manager client.

shell
"Authorization: Bearer <authenticate_token>"
plaintext
GET /packages/conan/v1/users/authenticate
GET /projects/:id/packages/conan/v1/users/authenticate
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.
shell
curl --user <username>:<your_access_token> \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/users/authenticate"

Example response:

shell
eyJhbGciOiJIUzI1NiIiheR5cCI6IkpXVCJ9.eyJhY2Nlc3NfdG9rZW4iOjMyMTQyMzAsqaVzZXJfaWQiOjQwNTkyNTQsImp0aSI6IjdlNzBiZTNjLWFlNWQtNDEyOC1hMmIyLWZiOThhZWM0MWM2OSIsImlhd3r1MTYxNjYyMzQzNSwibmJmIjoxNjE2NjIzNDMwLCJleHAiOjE2MTY2MjcwMzV9.QF0Q3ZIB2GW5zNKyMSIe0HIFOITjEsZEioR-27Rtu7E

Verify availability of a Conan repository

Verifies the availability of the GitLab Conan repository.

plaintext
GET /packages/conan/v1/ping
GET /projects/:id/packages/conan/v1/ping
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.
shell
curl --url "https://gitlab.example.com/api/v4/packages/conan/v1/ping"

Example response:

json
""

Search for a Conan package

Searches the instance for a specified Conan package.

plaintext
GET /packages/conan/v1/conans/search
GET /projects/:id/packages/conan/v1/conans/search
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.
qstringyesSearch query. You can use * as a wildcard.
shell
curl --user <username>:<your_access_token> \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/conans/search?q=Hello*"

Example response:

json
{
  "results": [
    "Hello/0.1@foo+conan_test_prod/beta",
    "Hello/0.1@foo+conan_test_prod/stable",
    "Hello/0.2@foo+conan_test_prod/beta",
    "Hello/0.3@foo+conan_test_prod/beta",
    "Hello/0.1@foo+conan-reference-test/stable",
    "HelloWorld/0.1@baz+conan-reference-test/beta"
    "hello-world/0.4@buz+conan-test/alpha"
  ]
}

Verify authentication credentials

Verifies the validity of Basic Auth credentials or a specified Conan JWT generated from the /authenticate endpoint.

plaintext
GET /packages/conan/v1/users/check_credentials
GET /projects/:id/packages/conan/v1/users/check_credentials
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.
shell
curl --header "Authorization: Bearer <authenticate_token>" \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/users/check_credentials"

Example response:

shell
ok

Retrieve a recipe snapshot

Retrieves a snapshot of the files for a specified Conan recipe. The snapshot is a list of filenames with their associated MD5 hash.

plaintext
GET /packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel
GET /projects/:id/packages/conan/v1/conans/:package_version/:package_username/:package_channel
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
shell
curl --header "Authorization: Bearer <authenticate_token>" \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/conans/my-package/1.0/my-group+my-project/stable"

Example response:

json
{
  "conan_sources.tgz": "eadf19b33f4c3c7e113faabf26e76277",
  "conanfile.py": "25e55b96a28f81a14ba8e8a8c99eeace",
  "conanmanifest.txt": "5b6fd77a2ba14303ce4cdb08c87e82ab"
}

Retrieve a package snapshot

Retrieves a snapshot of the files for a specified Conan package and reference. The snapshot is a list of filenames with their associated MD5 hash.

plaintext
GET /packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel/packages/:conan_package_reference
GET /projects/:id/packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel/packages/:conan_package_reference
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
conan_package_referencestringyesReference hash of a Conan package. Conan generates this value.
shell
curl --header "Authorization: Bearer <authenticate_token>" \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/conans/my-package/1.0/my-group+my-project/stable/packages/103f6067a947f366ef91fc1b7da351c588d1827f"

Example response:

json
{
  "conan_package.tgz": "749b29bdf72587081ca03ec033ee59dc",
  "conaninfo.txt": "32859d737fe84e6a7ccfa4d64dc0d1f2",
  "conanmanifest.txt": "a86b398e813bd9aa111485a9054a2301"
}

Retrieve a recipe manifest

Retrieves a manifest that includes a list of files and associated download URLs for a specified recipe.

plaintext
GET /packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel/digest
GET /projects/:id/packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel/digest
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
shell
curl --header "Authorization: Bearer <authenticate_token>" \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/conans/my-package/1.0/my-group+my-project/stable/digest"

Example response:

json
{
  "conan_sources.tgz": "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/0/export/conan_sources.tgz",
  "conanfile.py": "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/0/export/conanfile.py",
  "conanmanifest.txt": "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/0/export/conanmanifest.txt"
}

Retrieve a package manifest

Retrieves a manifest that includes a list of files and associated download URLs for a specified package.

plaintext
GET /packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel/packages/:conan_package_reference/digest
GET /projects/:id/packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel/packages/:conan_package_reference/digest
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
conan_package_referencestringyesReference hash of a Conan package. Conan generates this value.
shell
curl --header "Authorization: Bearer <authenticate_token>" \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/conans/my-package/1.0/my-group+my-project/stable/packages/103f6067a947f366ef91fc1b7da351c588d1827f/digest"

Example response:

json
{
  "conan_package.tgz": "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/packages/103f6067a947f366ef91fc1b7da351c588d1827f/0/conan_package.tgz",
  "conaninfo.txt": "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/packages/103f6067a947f366ef91fc1b7da351c588d1827f/0/conaninfo.txt",
  "conanmanifest.txt": "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/packages/103f6067a947f366ef91fc1b7da351c588d1827f/0/conanmanifest.txt"
}

List all recipe download URLs

Lists all files and associated download URLs for a specified recipe. Returns the same payload as the recipe manifest endpoint.

plaintext
GET /packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel/download_urls
GET /projects/:id/packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel/download_urls
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
shell
curl --header "Authorization: Bearer <authenticate_token>" \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/conans/my-package/1.0/my-group+my-project/stable/digest"

Example response:

json
{
  "conan_sources.tgz": "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/0/export/conan_sources.tgz",
  "conanfile.py": "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/0/export/conanfile.py",
  "conanmanifest.txt": "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/0/export/conanmanifest.txt"
}

List all package download URLs

Lists all files and associated download URLs for a specified package. Returns the same payload as the package manifest endpoint.

plaintext
GET /packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel/packages/:conan_package_reference/download_urls
GET /projects/:id/packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel/packages/:conan_package_reference/download_urls
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
conan_package_referencestringyesReference hash of a Conan package. Conan generates this value.
shell
curl --header "Authorization: Bearer <authenticate_token>" \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/conans/my-package/1.0/my-group+my-project/stable/packages/103f6067a947f366ef91fc1b7da351c588d1827f/download_urls"

Example response:

json
{
  "conan_package.tgz": "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/packages/103f6067a947f366ef91fc1b7da351c588d1827f/0/conan_package.tgz",
  "conaninfo.txt": "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/packages/103f6067a947f366ef91fc1b7da351c588d1827f/0/conaninfo.txt",
  "conanmanifest.txt": "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/packages/103f6067a947f366ef91fc1b7da351c588d1827f/0/conanmanifest.txt"
}

List all recipe upload URLs

Lists the upload URLs for a specified collection of recipe files. The request must include a JSON object with the name and size of the individual files.

plaintext
POST /packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel/upload_urls
POST /projects/:id/packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel/upload_urls
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.

Example request JSON payload:

The payload must include both the name and size of the file.

json
{
  "conanfile.py": 410,
  "conanmanifest.txt": 130
}
shell
curl --request POST \
     --header "Authorization: Bearer <authenticate_token>" \
     --header "Content-Type: application/json" \
     --data '{"conanfile.py":410,"conanmanifest.txt":130}' \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/conans/my-package/1.0/my-group+my-project/stable/upload_urls"

Example response:

json
{
  "conanfile.py": "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/0/export/conanfile.py",
  "conanmanifest.txt": "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/0/export/conanmanifest.txt"
}

List all package upload URLs

Lists the upload URLs for a specified collection of package files. The request must include a JSON object with the name and size of the individual files.

plaintext
POST /packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel/packages/:conan_package_reference/upload_urls
POST /projects/:id/packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel/packages/:conan_package_reference/upload_urls
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
conan_package_referencestringyesReference hash of a Conan package. Conan generates this value.

Example request JSON payload:

The payload must include both the name and size of the file.

json
{
  "conan_package.tgz": 5412,
  "conanmanifest.txt": 130,
  "conaninfo.txt": 210
}
shell
curl --request POST \
     --header "Authorization: Bearer <authenticate_token>" \
     --header "Content-Type: application/json" \
     --data '{"conan_package.tgz":5412,"conanmanifest.txt":130,"conaninfo.txt":210}' \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/conans/my-package/1.0/my-group+my-project/stable/packages/103f6067a947f366ef91fc1b7da351c588d1827f/upload_urls"

Example response:

json
{
  "conan_package.tgz": "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/0/package/103f6067a947f366ef91fc1b7da351c588d1827f/0/conan_package.tgz",
  "conanmanifest.txt": "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/0/package/103f6067a947f366ef91fc1b7da351c588d1827f/0/conanmanifest.txt",
  "conaninfo.txt": "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/0/package/103f6067a947f366ef91fc1b7da351c588d1827f/0/conaninfo.txt"
}

Retrieve a recipe file

Retrieves a specified recipe file from the package registry. You must use the download URL returned from the recipe download URLs endpoint.

plaintext
GET /packages/conan/v1/files/:package_name/:package_version/:package_username/:package_channel/:recipe_revision/export/:file_name
GET /projects/:id/packages/conan/v1/files/:package_name/:package_version/:package_username/:package_channel/:recipe_revision/export/:file_name
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
recipe_revisionstringyesRevision of the recipe. GitLab does not yet support Conan revisions, so the default value of 0 is always used.
file_namestringyesThe name and file extension of the requested file.
shell
curl --header "Authorization: Bearer <authenticate_token>" \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/0/export/conanfile.py"

You can also write the output to a file by using:

shell
curl --header "Authorization: Bearer <authenticate_token>" \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/0/export/conanfile.py" \
     >> conanfile.py

This example writes to conanfile.py in the current directory.

Upload a recipe file

Uploads a specified recipe file to the package registry. You must use the upload URL returned from the recipe upload URLs endpoint.

plaintext
PUT /packages/conan/v1/files/:package_name/:package_version/:package_username/:package_channel/:recipe_revision/export/:file_name
PUT /projects/:id/packages/conan/v1/files/:package_name/:package_version/:package_username/:package_channel/:recipe_revision/export/:file_name
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
recipe_revisionstringyesRevision of the recipe. GitLab does not yet support Conan revisions, so the default value of 0 is always used.
file_namestringyesThe name and file extension of the requested file.

Provide the file context in the request body:

shell
curl --request PUT \
     --user <username>:<personal_access_token> \
     --upload-file path/to/conanfile.py \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/0/export/conanfile.py"

Retrieve a package file

Retrieves a specified package file from the package registry. You must use the download URL returned from the package download URLs endpoint.

plaintext
GET /packages/conan/v1/files/:package_name/:package_version/:package_username/:package_channel/:recipe_revision/package/:conan_package_reference/:package_revision/:file_name
GET /projects/:id/packages/conan/v1/files/:package_name/:package_version/:package_username/:package_channel/:recipe_revision/package/:conan_package_reference/:package_revision/:file_name
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
recipe_revisionstringyesRevision of the recipe. GitLab does not yet support Conan revisions, so the default value of 0 is always used.
conan_package_referencestringyesReference hash of a Conan package. Conan generates this value.
package_revisionstringyesRevision of the package. GitLab does not yet support Conan revisions, so the default value of 0 is always used.
file_namestringyesThe name and file extension of the requested file.
shell
curl --header "Authorization: Bearer <authenticate_token>" \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/packages/103f6067a947f366ef91fc1b7da351c588d1827f/0/conaninfo.txt"

You can also write the output to a file by using:

shell
curl --header "Authorization: Bearer <authenticate_token>" \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/packages/103f6067a947f366ef91fc1b7da351c588d1827f/0/conaninfo.txt" \
     >> conaninfo.txt

This example writes to conaninfo.txt in the current directory.

Upload a package file

Uploads a specified package file to the package registry. You must use the upload URL returned from the package upload URLs endpoint.

plaintext
PUT /packages/conan/v1/files/:package_name/:package_version/:package_username/:package_channel/:recipe_revision/package/:conan_package_reference/:package_revision/:file_name
PUT /projects/:id/packages/conan/v1/files/:package_name/:package_version/:package_username/:package_channel/:recipe_revision/package/:conan_package_reference/:package_revision/:file_name
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
recipe_revisionstringyesRevision of the recipe. GitLab does not yet support Conan revisions, so the default value of 0 is always used.
conan_package_referencestringyesReference hash of a Conan package. Conan generates this value.
package_revisionstringyesRevision of the package. GitLab does not yet support Conan revisions, so the default value of 0 is always used.
file_namestringyesThe name and file extension of the requested file.

Provide the file context in the request body:

shell
curl --request PUT \
     --user <username>:<your_access_token> \
     --upload-file path/to/conaninfo.txt \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/files/my-package/1.0/my-group+my-project/stable/0/package/103f6067a947f366ef91fc1b7da351c588d1827f/0/conaninfo.txt"

Delete a recipe and package

Deletes a specified Conan recipe and associated package files from the package registry.

plaintext
DELETE /packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel
DELETE /projects/:id/packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
shell
curl --request DELETE \
     --header "Authorization: Bearer <authenticate_token>" \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/conans/my-package/1.0/my-group+my-project/stable"

Example response:

json
{
  "id": 1,
  "project_id": 123,
  "created_at": "2020-08-19T13:17:28.655Z",
  "updated_at": "2020-08-19T13:17:28.655Z",
  "name": "my-package",
  "version": "1.0",
  "package_type": "conan",
  "creator_id": null,
  "status": "default"
}

Retrieve package references metadata

Retrieves the metadata for all package references of a specified package.

plaintext
GET /packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel/search
GET /projects/:id/packages/conan/v1/conans/:package_name/:package_version/:package_username/:package_channel/search
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
shell
curl --header "Authorization: Bearer <authenticate_token>" \
     --url "https://gitlab.example.com/api/v4/packages/conan/v1/conans/my-package/1.0/my-group+my-project/stable/search"

Example response:

json
{
  "103f6067a947f366ef91fc1b7da351c588d1827f": {
    "settings": {
      "arch": "x86_64",
      "build_type": "Release",
      "compiler": "gcc",
      "compiler.libcxx": "libstdc++",
      "compiler.version": "9",
      "os": "Linux"
    },
    "options": {
      "shared": "False"
    },
    "requires": {
      "zlib/1.2.11": null
    },
    "recipe_hash": "75151329520e7685dcf5da49ded2fec0"
  }
}

The response includes the following metadata for each package reference:

  • settings: The build settings used for the package.
  • options: The package options.
  • requires: The dependencies required for the package.
  • recipe_hash: The hash of the recipe.