AAI Bulk Add/Process APIs (Being Deprecated)
Bulk Add
Getting Started with the Bulk add API
To execute a bulk add, a client will perform a PUT on the bulk add API URI and include a payload indicating the nodes to be added.The version (v$ ie. v15) dictates which release's REST API version the output will be based on.
Note: bulkadd API will only accept PUT operations, if you require PUT/PATCH/DELETE please use bulkprocess endpoint
API URI
PUT /aai/v$/bulkadd |
---|
Payload
The payload must include a "transactions" parameter. This typically is an array of multiple "put" operations that include the associated A&AI URI for the put operation and corresponding body payload. Multiple PUT operations can be done within a single transaction or can be split into multiple transactions. A transaction's changes will not be committed to the database unless all operations within a single transaction succeed. Each transaction must include a "put" array including at least one set of "uri" and "body" parameters. The "uri" parameter designates the endpoint of the A&AI (C)RUD operation that will add the node/relationship, the "body" designates the payload that URI accepts to do so.
Example Payloads
Request #1: Single transaction, multiple put operations
Add Request 1
{
"transactions": [{
"put": [{
"uri": "/network/pnfs/pnf/pnf1",
"body": {
"pnf-name": "pnf1",
"equip-model": "equip1",
"frame-id": "1234",
"equip-type": "router"
}
}, {
"uri": "/network/pnfs/pnf/pnf2",
"body": {
"pnf-name": "pnf2",
"equip-model": "equip2",
"frame-id": "4321",
"equip-type": "router"
}
}]
}]
}
Request #2: Multiple transactions, first transaction has one put operation, second has many
Add Request 2
{
"transactions": [{
"put": [{
"uri": "/network/pnfs/pnf/pnf1",
"body": {
"pnf-name": "pnf1",
"equip-model": "equip1",
"frame-id": "1234",
"equip-type": "router"
}
}]
},
{
"put": [{
"uri": "/network/pnfs/pnf/pnf1/p-interfaces/p-interface/pinterface1",
"body": {
"interface-name": "pinterface1",
"equipment-identifier": "equipiden1",
"port-description": "pd1"
}
}, {
"uri": "/network/pnfs/pnf/pnf1/p-interfaces/p-interface/pinterface2",
"body": {
"interface-name": "pinterface2",
"equipment-identifier": "equipiden2",
"port-description": "pd2"
}
}, {
"uri": "/network/pnfs/pnf/pnf1/p-interfaces/p-interface/pinterface3",
"body": {
"interface-name": "pinterface3",
"equipment-identifier": "equipiden3",
"port-description": "pd3"
}
}, {
"uri": "/network/logical-links/logical-link/logicallink1",
"body": {
"link-name": "logicallink1",
"link-type": "linktype1",
"operational-status": "available",
"speed-value": "100",
"speed-units": "Gbps",
"relationship-list": {
"relationship": [{
"related-to": "p-interface",
"relationship-data": [{
"relationship-key": "pnf.pnf-name",
"relationship-value": "pnf1"
}, {
"relationship-key": "p-interface.interface-name",
"relationship-value": "pinterface1"
}]
}]
}
}
}]
}
]
}
Response
Each operation will have its own object with "uri" parameter designating which endpoint reported the response, the "body" with include the response code.
Example Response
Below response is from request #2, when all transactions were successful
Add Response 1
{"transaction": [
{
"put": [
{
"uri": "/network/pnfs/pnf/pnf1",
"body": {
"201": null
}
}
]
},
{
"put": [
{
"uri": "/network/pnfs/pnf/pnf2",
"body": {
"201": null
}
}
]
},
{
"put": [
{
"uri": "/network/pnfs/pnf/pnf1/p-interfaces/p-interface/p-interface1",
"body": {
"201": null
}
},
{
"uri": "/network/pnfs/pnf/pnf1/p-interfaces/p-interface/pinterface2",
"body": {
"201": null
}
},
{
"uri": "/network/pnfs/pnf/pnf1/p-interfaces/p-interface/p-interface3",
"body": {
"201": null
}
},
{
"uri": "/network/logical-links/logical-link/logicallink1",
"body": {
"201": null
}
}
]
}
]
}
Below is a response from request #1 when an error occurred on both add operations
Add Response 2
Operation Limit
There is a default limit of 30 operations per bulk API call, this value is configurable and may be modified. The response returned on a call exceeding this limit will inform the client of the limit in the error response. This error is an overall block so response will be given once, not per operation.