assign_batches

imerit_ango.sdk.SDK.

assign_batches(project_id, asset_ids, batches)

Assign a list of assets to one or more existing batches.

Parameters

  • project_id: string

  • asset_ids: List[str]

    • List of asset IDs to assign to batches. Asset IDs can be obtained from the UI, or from get_assets.

    • Example: ['0000000aa0a00a0000aaaa0a', '0000000aa0a00a0000aaaa0b']

  • batches: List[str]

    • List of batches to which assets will be assigned.

    • You can pass a list of batch IDs. Batch IDs can be obtained with get_batches function.

    • Example:

      • ['0000000aa0a00a0000aaaa0a', '0000000aa0a00a0000aaaa0b']

Returns:

  • output: dict

    • A dictionary containing the result of the operation.

Example

import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

asset_ids = ['<YOUR ASSET ID 1>', '<YOUR ASSET ID 2>', '<YOUR ASSET ID 3>']
batch_ids = ['<YOUR BATCH ID 1>', '<YOUR BATCH ID 2>']

ango_sdk.assign_batches(project_id, asset_ids, batch_ids)

Outputs:

{
  'status': 'success',
  'data': {
    'assets': {
      'count': 3,
      'message': 'Successfully assigned 2 batches to 3 assets: <YOUR BATCH ID 1>, <YOUR BATCH ID 2>'
    }
  }
}

Where "assets" is the number of assets successfully assigned to the batch(es).

Last updated