Provision Assets in Bulk

POST /ocaapi/v2.0/asset/bulk

To provision more than one asset. Using this API, you can provision up to 1000 assets.

The minimum curl stable version 7.70.0 is required for the OCA API POST call to be executed using file bulk command upload via curl command.

HTTP Status Code

- 200: OK

- 400: Bad Request

- 401: Unauthorized user

- 403: Forbidden

- 404: Not Found

Input ParametersInput Parameters

Parameter

Mandatory

/Optional

Data Type

Description

data

Mandatory

File

File containing the entries of asset to be provisioned.

Accepted Files:  .csv and .txt.

Example: bulk_provision.csv or bulk_provision.txt

manifest_types Mandatory  String

Manifest type of asset.

Allowed values: PolicyCompliance

Header ParametersHeader Parameters

Parameter

Mandatory

/Optional

Data Type

Description

assetFlowType

 Optional

Text

Provide asset flow type. The default value is DEFAULT.
authorization Mandatory  Text The token that was generated using the Fetch Authentication Token API.

SampleSample

API Request

"curl -X POST""https://<api_gateway_url>/ocaapi/v2.0/asset/bulk?manifest_types=PolicyCompliance"" -H""assetFlowType: DEFAULT"" -H""Authorization: Bearer <token>"" -H""Content-Type: multipart/form-data""-F""data=@file_path"      
    

Response: Unsuccessful upload response

{
   "   ""_error":{
      "       ""code":400,
      "        ""message":"ERR-2052 - [txt,csv] are supported extension.Please upload file appropriately""   "
   }
}      
    

Response: Successful upload response

{
   " ""code":200,
   " ""data":{
      "   ""items":{
         "     ""count":{
            "       ""successfulProvisions":4,
            "       ""failedProvisions":0,
            "       ""skipppedProvisions":0
     
         },
         "     ""successfulProvisions":[
            "       "{
               "         ""uuid":"cc1f2ce1-fb4c-40d9-84fe-6a41c33fd0a4",
               "         ""ip":"44.45.36.65",
               "         ""technology":"Fabric 7""       "
            },
            "       "{
               "         ""uuid":"ae99b9d3-d1eb-4004-bea8-4270ac94732c",
               "         ""ip":"44.45.38.89",
               "         ""technology":"Fabric 8""       "
            },
            "       "{
               "         ""uuid":"a793043b-5a3b-4007-90f6-be695ec52eb9",
               "         ""ip":"45.45.34.66",
               "         ""technology":"Fabric 7""       "
            },
            "       "{
               "         ""uuid":"51f1ee4a-9f0e-4531-9d3a-5cde9901ce1b",
               "         ""ip":"44.45.37.62",
               "         ""technology":"Fabric 8""       "
            }"     "
         ],
         "     ""failedProvisions":[
            
         ],
         "     ""skippedProvisions":[
            
         ]"   "
      }" "
   }
}