ProjectsApi class reference

All URIs are relative tohttp://localhost

MethodHTTP requestDescription
createPOST /api/projectsCreate a project
create_backupPOST /api/projects/backup/Recreate a project from a backup
create_backup_exportPOST /api/projects/{id}/backup/exportInitiate process to backup resource
create_datasetPOST /api/projects/{id}/dataset/Import a dataset into a project
create_dataset_exportPOST /api/projects/{id}/dataset/exportInitialize process to export resource as a dataset in a specific format
destroyDELETE /api/projects/{id}Delete a project
listGET /api/projectsList projects
partial_updatePATCH /api/projects/{id}Update a project
retrieveGET /api/projects/{id}Get project details
retrieve_previewGET /api/projects/{id}/previewGet a preview image for a project

create

create(project_write_request,x_organization=None,org=None,org_id=None,**kwargs)

Create a project

Example

frompprintimportpprintfromcvat_sdk.api_clientimportConfiguration,ApiClient,exceptionsfromcvat_sdk.api_client.modelsimport*# Set up an API client# Read Configuration class docs for more info about parameters and authentication methodsconfiguration=Configuration(host="http://localhost",username='YOUR_USERNAME',password='YOUR_PASSWORD',)withApiClient(configuration)asapi_client:project_write_request=ProjectWriteRequest(name="name_example",labels=[PatchedLabelRequest(id=1,name="name_example",color="color_example",attributes=[AttributeRequest(id=1,name="name_example",mutable=True,input_type=InputTypeEnum("checkbox"),default_value="default_value_example",values=["values_example",],),],deleted=True,type=None,svg="svg_example",sublabels=[SublabelRequest(id=1,name="name_example",color="color_example",attributes=[AttributeRequest(id=1,name="name_example",mutable=True,input_type=InputTypeEnum("checkbox"),default_value="default_value_example",values=["values_example",],),],type=None,has_parent=True,),],),],owner_id=1,assignee_id=1,bug_tracker="bug_tracker_example",target_storage=PatchedProjectWriteRequestTargetStorage(None),source_storage=PatchedProjectWriteRequestTargetStorage(None),)# ProjectWriteRequest |x_organization="X-Organization_example"# str | Organization unique slug (optional)org="org_example"# str | Organization unique slug (optional)org_id=1# int | Organization identifier (optional)try:(data,response)=api_client.projects_api.create(project_write_request,x_organization=x_organization,org=org,org_id=org_id,)pprint(data)exceptexceptions.ApiExceptionase:print("Exception when calling ProjectsApi.create():%s\n"%e)

Parameters

NameTypeDescriptionNotes
project_write_requestProjectWriteRequest
x_organizationstrOrganization unique slug[optional]
orgstrOrganization unique slug[optional]
org_idintOrganization identifier[optional]

There are also optional kwargs that control the function invocation behavior.Read more here.

Returned values

Returned type:Tuple[ProjectRead, urllib3.HTTPResponse].

Returns a tuple with 2 values:(parsed_response, raw_response).

The first value is a model parsed from the response data.The second value is the raw response, which can be useful to get response parameters, such asstatus code, headers, or raw response data. Read more about invocation parametersand returned valueshere.

Authentication

basicAuth, csrfAuth, csrfHeaderAuth, sessionAuth, signatureAuth, tokenAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/vnd.cvat+json

HTTP response details

Status codeDescriptionResponse headers
201-

create_backup

create_backup(x_organization=None,cloud_storage_id=None,filename=None,location=None,org=None,org_id=None,project_file_request=None,**kwargs)

Recreate a project from a backup

The backup import process is as follows: The first request POST /api/projects/backup schedules a background job on the server in which the process of creating a project from the uploaded backup is carried out. To check the status of the import process, use GET /api/requests/rq_id, where rq_id is the request ID obtained from the response to the previous request. Once the import completes successfully, the response will contain the ID of the newly created project in the result_id field.

Example

frompprintimportpprintfromcvat_sdk.api_clientimportConfiguration,ApiClient,exceptionsfromcvat_sdk.api_client.modelsimport*# Set up an API client# Read Configuration class docs for more info about parameters and authentication methodsconfiguration=Configuration(host="http://localhost",username='YOUR_USERNAME',password='YOUR_PASSWORD',)withApiClient(configuration)asapi_client:x_organization="X-Organization_example"# str | Organization unique slug (optional)cloud_storage_id=1# int | Storage id (optional)filename="filename_example"# str | Backup file name (optional)location="local"# str | Where to import the backup file from (optional) if omitted the server will use the default value of "local"org="org_example"# str | Organization unique slug (optional)org_id=1# int | Organization identifier (optional)project_file_request=ProjectFileRequest(project_file=open('/path/to/file','rb'),)# ProjectFileRequest |  (optional)try:(data,response)=api_client.projects_api.create_backup(x_organization=x_organization,cloud_storage_id=cloud_storage_id,filename=filename,location=location,org=org,org_id=org_id,project_file_request=project_file_request,)pprint(data)exceptexceptions.ApiExceptionase:print("Exception when calling ProjectsApi.create_backup():%s\n"%e)

Parameters

NameTypeDescriptionNotes
x_organizationstrOrganization unique slug[optional]
cloud_storage_idintStorage id[optional]
filenamestrBackup file name[optional]
locationstrWhere to import the backup file from[optional] if omitted the server will use the default value of “local”
orgstrOrganization unique slug[optional]
org_idintOrganization identifier[optional]
project_file_requestProjectFileRequest[optional]

There are also optional kwargs that control the function invocation behavior.Read more here.

Returned values

Returned type:Tuple[RqId, urllib3.HTTPResponse].

Returns a tuple with 2 values:(parsed_response, raw_response).

The first value is a model parsed from the response data.The second value is the raw response, which can be useful to get response parameters, such asstatus code, headers, or raw response data. Read more about invocation parametersand returned valueshere.

Authentication

basicAuth, csrfAuth, csrfHeaderAuth, sessionAuth, signatureAuth, tokenAuth

HTTP request headers

  • Content-Type: application/json, multipart/form-data
  • Accept: application/vnd.cvat+json

HTTP response details

Status codeDescriptionResponse headers
202Import of the backup file has started-

create_backup_export

create_backup_export(id,cloud_storage_id=None,filename=None,location=None,**kwargs)

Initiate process to backup resource

The requestPOST /api/<projects|tasks>/id/backup/export will initialize a background process to backup a resource. To check status of the process please, useGET /api/requests/<rq_id> whererq_id is request ID returned in the response for this endpoint.

Example

frompprintimportpprintfromcvat_sdk.api_clientimportConfiguration,ApiClient,exceptionsfromcvat_sdk.api_client.modelsimport*# Set up an API client# Read Configuration class docs for more info about parameters and authentication methodsconfiguration=Configuration(host="http://localhost",username='YOUR_USERNAME',password='YOUR_PASSWORD',)withApiClient(configuration)asapi_client:id=1# int | A unique integer value identifying this project.cloud_storage_id=1# int | Storage id (optional)filename="filename_example"# str | Backup file name (optional)location="cloud_storage"# str | Where need to save downloaded backup (optional)try:(data,response)=api_client.projects_api.create_backup_export(id,cloud_storage_id=cloud_storage_id,filename=filename,location=location,)pprint(data)exceptexceptions.ApiExceptionase:print("Exception when calling ProjectsApi.create_backup_export():%s\n"%e)

Parameters

NameTypeDescriptionNotes
idintA unique integer value identifying this project.
cloud_storage_idintStorage id[optional]
filenamestrBackup file name[optional]
locationstrWhere need to save downloaded backup[optional]

There are also optional kwargs that control the function invocation behavior.Read more here.

Returned values

Returned type:Tuple[RqId, urllib3.HTTPResponse].

Returns a tuple with 2 values:(parsed_response, raw_response).

The first value is a model parsed from the response data.The second value is the raw response, which can be useful to get response parameters, such asstatus code, headers, or raw response data. Read more about invocation parametersand returned valueshere.

Authentication

basicAuth, csrfAuth, csrfHeaderAuth, sessionAuth, signatureAuth, tokenAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/vnd.cvat+json

HTTP response details

Status codeDescriptionResponse headers
202Creating a backup file has been started-
400Wrong query parameters were passed-
409The backup process has already been initiated and is not yet finished-

create_dataset

create_dataset(id,cloud_storage_id=None,filename=None,format=None,location=None,dataset_file_request=None,**kwargs)

Import a dataset into a project

The request POST /api/projects/id/dataset initiates a background process to import dataset into a project. Please, use the GET /api/requests/<rq_id> endpoint for checking status of the process. Therq_id parameter can be found in the response on initiating request.

Example

frompprintimportpprintfromcvat_sdk.api_clientimportConfiguration,ApiClient,exceptionsfromcvat_sdk.api_client.modelsimport*# Set up an API client# Read Configuration class docs for more info about parameters and authentication methodsconfiguration=Configuration(host="http://localhost",username='YOUR_USERNAME',password='YOUR_PASSWORD',)withApiClient(configuration)asapi_client:id=1# int | A unique integer value identifying this project.cloud_storage_id=1# int | Storage id (optional)filename="filename_example"# str | Dataset file name (optional)format="format_example"# str | Desired dataset format name You can get the list of supported formats at: /server/annotation/formats (optional)location="cloud_storage"# str | Where to import the dataset from (optional)dataset_file_request=DatasetFileRequest(dataset_file=open('/path/to/file','rb'),)# DatasetFileRequest |  (optional)try:(data,response)=api_client.projects_api.create_dataset(id,cloud_storage_id=cloud_storage_id,filename=filename,format=format,location=location,dataset_file_request=dataset_file_request,)pprint(data)exceptexceptions.ApiExceptionase:print("Exception when calling ProjectsApi.create_dataset():%s\n"%e)

Parameters

NameTypeDescriptionNotes
idintA unique integer value identifying this project.
cloud_storage_idintStorage id[optional]
filenamestrDataset file name[optional]
formatstrDesired dataset format name You can get the list of supported formats at: /server/annotation/formats[optional]
locationstrWhere to import the dataset from[optional]
dataset_file_requestDatasetFileRequest[optional]

There are also optional kwargs that control the function invocation behavior.Read more here.

Returned values

Returned type:Tuple[RqId, urllib3.HTTPResponse].

Returns a tuple with 2 values:(parsed_response, raw_response).

The first value is a model parsed from the response data.The second value is the raw response, which can be useful to get response parameters, such asstatus code, headers, or raw response data. Read more about invocation parametersand returned valueshere.

Authentication

basicAuth, csrfAuth, csrfHeaderAuth, sessionAuth, signatureAuth, tokenAuth

HTTP request headers

  • Content-Type: application/json, multipart/form-data
  • Accept: application/vnd.cvat+json

HTTP response details

Status codeDescriptionResponse headers
202Importing has been started-
400Failed to import dataset-
405Format is not available-

create_dataset_export

create_dataset_export(format,id,cloud_storage_id=None,filename=None,location=None,save_images=None,**kwargs)

Initialize process to export resource as a dataset in a specific format

The requestPOST /api/<projects|tasks|jobs>/id/dataset/export will initialize a background process to export a dataset. To check status of the process please, useGET /api/requests/<rq_id> whererq_id is request ID returned in the response for this endpoint.

Example

frompprintimportpprintfromcvat_sdk.api_clientimportConfiguration,ApiClient,exceptionsfromcvat_sdk.api_client.modelsimport*# Set up an API client# Read Configuration class docs for more info about parameters and authentication methodsconfiguration=Configuration(host="http://localhost",username='YOUR_USERNAME',password='YOUR_PASSWORD',)withApiClient(configuration)asapi_client:format="format_example"# str | Desired output format name You can get the list of supported formats at: /server/annotation/formatsid=1# int | A unique integer value identifying this project.cloud_storage_id=1# int | Storage id (optional)filename="filename_example"# str | Desired output file name (optional)location="cloud_storage"# str | Where need to save downloaded dataset (optional)save_images=False# bool | Include images or not (optional) if omitted the server will use the default value of Falsetry:(data,response)=api_client.projects_api.create_dataset_export(format,id,cloud_storage_id=cloud_storage_id,filename=filename,location=location,save_images=save_images,)pprint(data)exceptexceptions.ApiExceptionase:print("Exception when calling ProjectsApi.create_dataset_export():%s\n"%e)

Parameters

NameTypeDescriptionNotes
formatstrDesired output format name You can get the list of supported formats at: /server/annotation/formats
idintA unique integer value identifying this project.
cloud_storage_idintStorage id[optional]
filenamestrDesired output file name[optional]
locationstrWhere need to save downloaded dataset[optional]
save_imagesboolInclude images or not[optional] if omitted the server will use the default value of False

There are also optional kwargs that control the function invocation behavior.Read more here.

Returned values

Returned type:Tuple[RqId, urllib3.HTTPResponse].

Returns a tuple with 2 values:(parsed_response, raw_response).

The first value is a model parsed from the response data.The second value is the raw response, which can be useful to get response parameters, such asstatus code, headers, or raw response data. Read more about invocation parametersand returned valueshere.

Authentication

basicAuth, csrfAuth, csrfHeaderAuth, sessionAuth, signatureAuth, tokenAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/vnd.cvat+json

HTTP response details

Status codeDescriptionResponse headers
202Exporting has been started-
405Format is not available-
409Exporting is already in progress-

destroy

destroy(id,**kwargs)

Delete a project

Example

frompprintimportpprintfromcvat_sdk.api_clientimportConfiguration,ApiClient,exceptionsfromcvat_sdk.api_client.modelsimport*# Set up an API client# Read Configuration class docs for more info about parameters and authentication methodsconfiguration=Configuration(host="http://localhost",username='YOUR_USERNAME',password='YOUR_PASSWORD',)withApiClient(configuration)asapi_client:id=1# int | A unique integer value identifying this project.try:api_client.projects_api.destroy(id,)exceptexceptions.ApiExceptionase:print("Exception when calling ProjectsApi.destroy():%s\n"%e)

Parameters

NameTypeDescriptionNotes
idintA unique integer value identifying this project.

There are also optional kwargs that control the function invocation behavior.Read more here.

Returned values

Returned type:Tuple[None, urllib3.HTTPResponse].

Returns a tuple with 2 values:(None, raw_response).

This endpoint does not have any return value, soNone is always returned as the first value.The second value is the raw response, which can be useful to get response parameters, such asstatus code, headers, or raw response data. Read more about invocation parametersand returned valueshere.

Authentication

basicAuth, csrfAuth, csrfHeaderAuth, sessionAuth, signatureAuth, tokenAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status codeDescriptionResponse headers
204The project has been deleted-

list

list(x_organization=None,assignee=None,filter=None,name=None,org=None,org_id=None,owner=None,page=None,page_size=None,search=None,sort=None,status=None,**kwargs)

List projects

Example

frompprintimportpprintfromcvat_sdk.api_clientimportConfiguration,ApiClient,exceptionsfromcvat_sdk.api_client.modelsimport*# Set up an API client# Read Configuration class docs for more info about parameters and authentication methodsconfiguration=Configuration(host="http://localhost",username='YOUR_USERNAME',password='YOUR_PASSWORD',)withApiClient(configuration)asapi_client:x_organization="X-Organization_example"# str | Organization unique slug (optional)assignee="assignee_example"# str | A simple equality filter for the assignee field (optional)filter="filter_example"# str |  JSON Logic filter. This filter can be used to perform complex filtering by grouping rules.  For example, using such a filter you can get all resources created by you:      - {\"and\":[{\"==\":[{\"var\":\"owner\"},\"<user>\"]}]}  Details about the syntax used can be found at the link: https://jsonlogic.com/   Available filter_fields: ['name', 'owner', 'assignee', 'status', 'id', 'updated_date']. (optional)name="name_example"# str | A simple equality filter for the name field (optional)org="org_example"# str | Organization unique slug (optional)org_id=1# int | Organization identifier (optional)owner="owner_example"# str | A simple equality filter for the owner field (optional)page=1# int | A page number within the paginated result set. (optional)page_size=1# int | Number of results to return per page. (optional)search="search_example"# str | A search term. Available search_fields: ('name', 'owner', 'assignee', 'status') (optional)sort="sort_example"# str | Which field to use when ordering the results. Available ordering_fields: ['name', 'owner', 'assignee', 'status', 'id', 'updated_date'] (optional)status="annotation"# str | A simple equality filter for the status field (optional)try:(data,response)=api_client.projects_api.list(x_organization=x_organization,assignee=assignee,filter=filter,name=name,org=org,org_id=org_id,owner=owner,page=page,page_size=page_size,search=search,sort=sort,status=status,)pprint(data)exceptexceptions.ApiExceptionase:print("Exception when calling ProjectsApi.list():%s\n"%e)

Parameters

NameTypeDescriptionNotes
x_organizationstrOrganization unique slug[optional]
assigneestrA simple equality filter for the assignee field[optional]
filterstrJSON Logic filter. This filter can be used to perform complex filtering by grouping rules. For example, using such a filter you can get all resources created by you: - {"and":[{"==":[{"var":"owner"},""]}]} Details about the syntax used can be found at the link:https://jsonlogic.com/ Available filter_fields: [’name’, ‘owner’, ‘assignee’, ‘status’, ‘id’, ‘updated_date’].[optional]
namestrA simple equality filter for the name field[optional]
orgstrOrganization unique slug[optional]
org_idintOrganization identifier[optional]
ownerstrA simple equality filter for the owner field[optional]
pageintA page number within the paginated result set.[optional]
page_sizeintNumber of results to return per page.[optional]
searchstrA search term. Available search_fields: (’name’, ‘owner’, ‘assignee’, ‘status’)[optional]
sortstrWhich field to use when ordering the results. Available ordering_fields: [’name’, ‘owner’, ‘assignee’, ‘status’, ‘id’, ‘updated_date’][optional]
statusstrA simple equality filter for the status field[optional]

There are also optional kwargs that control the function invocation behavior.Read more here.

Returned values

Returned type:Tuple[PaginatedProjectReadList, urllib3.HTTPResponse].

Returns a tuple with 2 values:(parsed_response, raw_response).

The first value is a model parsed from the response data.The second value is the raw response, which can be useful to get response parameters, such asstatus code, headers, or raw response data. Read more about invocation parametersand returned valueshere.

Authentication

basicAuth, csrfAuth, csrfHeaderAuth, sessionAuth, signatureAuth, tokenAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/vnd.cvat+json

HTTP response details

Status codeDescriptionResponse headers
200-

partial_update

partial_update(id,patched_project_write_request=None,**kwargs)

Update a project

Example

frompprintimportpprintfromcvat_sdk.api_clientimportConfiguration,ApiClient,exceptionsfromcvat_sdk.api_client.modelsimport*# Set up an API client# Read Configuration class docs for more info about parameters and authentication methodsconfiguration=Configuration(host="http://localhost",username='YOUR_USERNAME',password='YOUR_PASSWORD',)withApiClient(configuration)asapi_client:id=1# int | A unique integer value identifying this project.patched_project_write_request=PatchedProjectWriteRequest(name="name_example",labels=[PatchedLabelRequest(id=1,name="name_example",color="color_example",attributes=[AttributeRequest(id=1,name="name_example",mutable=True,input_type=InputTypeEnum("checkbox"),default_value="default_value_example",values=["values_example",],),],deleted=True,type=None,svg="svg_example",sublabels=[SublabelRequest(id=1,name="name_example",color="color_example",attributes=[AttributeRequest(id=1,name="name_example",mutable=True,input_type=InputTypeEnum("checkbox"),default_value="default_value_example",values=["values_example",],),],type=None,has_parent=True,),],),],owner_id=1,assignee_id=1,bug_tracker="bug_tracker_example",target_storage=PatchedProjectWriteRequestTargetStorage(None),source_storage=PatchedProjectWriteRequestTargetStorage(None),)# PatchedProjectWriteRequest |  (optional)try:(data,response)=api_client.projects_api.partial_update(id,patched_project_write_request=patched_project_write_request,)pprint(data)exceptexceptions.ApiExceptionase:print("Exception when calling ProjectsApi.partial_update():%s\n"%e)

Parameters

NameTypeDescriptionNotes
idintA unique integer value identifying this project.
patched_project_write_requestPatchedProjectWriteRequest[optional]

There are also optional kwargs that control the function invocation behavior.Read more here.

Returned values

Returned type:Tuple[ProjectRead, urllib3.HTTPResponse].

Returns a tuple with 2 values:(parsed_response, raw_response).

The first value is a model parsed from the response data.The second value is the raw response, which can be useful to get response parameters, such asstatus code, headers, or raw response data. Read more about invocation parametersand returned valueshere.

Authentication

basicAuth, csrfAuth, csrfHeaderAuth, sessionAuth, signatureAuth, tokenAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/vnd.cvat+json

HTTP response details

Status codeDescriptionResponse headers
200-

retrieve

retrieve(id,**kwargs)

Get project details

Example

frompprintimportpprintfromcvat_sdk.api_clientimportConfiguration,ApiClient,exceptionsfromcvat_sdk.api_client.modelsimport*# Set up an API client# Read Configuration class docs for more info about parameters and authentication methodsconfiguration=Configuration(host="http://localhost",username='YOUR_USERNAME',password='YOUR_PASSWORD',)withApiClient(configuration)asapi_client:id=1# int | A unique integer value identifying this project.try:(data,response)=api_client.projects_api.retrieve(id,)pprint(data)exceptexceptions.ApiExceptionase:print("Exception when calling ProjectsApi.retrieve():%s\n"%e)

Parameters

NameTypeDescriptionNotes
idintA unique integer value identifying this project.

There are also optional kwargs that control the function invocation behavior.Read more here.

Returned values

Returned type:Tuple[ProjectRead, urllib3.HTTPResponse].

Returns a tuple with 2 values:(parsed_response, raw_response).

The first value is a model parsed from the response data.The second value is the raw response, which can be useful to get response parameters, such asstatus code, headers, or raw response data. Read more about invocation parametersand returned valueshere.

Authentication

basicAuth, csrfAuth, csrfHeaderAuth, sessionAuth, signatureAuth, tokenAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/vnd.cvat+json

HTTP response details

Status codeDescriptionResponse headers
200-

retrieve_preview

retrieve_preview(id,**kwargs)

Get a preview image for a project

Example

frompprintimportpprintfromcvat_sdk.api_clientimportConfiguration,ApiClient,exceptionsfromcvat_sdk.api_client.modelsimport*# Set up an API client# Read Configuration class docs for more info about parameters and authentication methodsconfiguration=Configuration(host="http://localhost",username='YOUR_USERNAME',password='YOUR_PASSWORD',)withApiClient(configuration)asapi_client:id=1# int | A unique integer value identifying this project.try:api_client.projects_api.retrieve_preview(id,)exceptexceptions.ApiExceptionase:print("Exception when calling ProjectsApi.retrieve_preview():%s\n"%e)

Parameters

NameTypeDescriptionNotes
idintA unique integer value identifying this project.

There are also optional kwargs that control the function invocation behavior.Read more here.

Returned values

Returned type:Tuple[None, urllib3.HTTPResponse].

Returns a tuple with 2 values:(None, raw_response).

This endpoint does not have any return value, soNone is always returned as the first value.The second value is the raw response, which can be useful to get response parameters, such asstatus code, headers, or raw response data. Read more about invocation parametersand returned valueshere.

Authentication

basicAuth, csrfAuth, csrfHeaderAuth, sessionAuth, signatureAuth, tokenAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status codeDescriptionResponse headers
200Project image preview-
404Project image preview not found-