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
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
{
"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
{
"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
{"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
{
"transaction": [
{
"put": [
{
"uri": "/network/pnfs/pnf/pnf1",
"body": {
"412": "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3000\",\"text\":\"Invalid input performing %1 on %2 (msg=%3) (ec=%4)\",\"variables\":[\"PUT\",\"/network/pnfs/pnf/pnf1\",\"Precondition Required:resource-version not passed for update of /network/pnfs/pnf/pnf1\",\"ERR.5.4.6130\"]}}}"
}
},
{
"uri": "/network/pnfs/pnf/pnf2",
"body": {
"412": "{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC3000\",\"text\":\"Invalid input performing %1 on %2 (msg=%3) (ec=%4)\",\"variables\":[\"PUT\",\"/network/pnfs/pnf/pnf2\",\"Precondition Required:resource-version not passed for update of /network/pnfs/pnf/pnf2\",\"ERR.5.4.6130\"]}}}"
}
}
]
}
]
}
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.
{
"requestError": {
"serviceException": {
"messageId": "SVC3000",
"text": "Invalid input performing %1 on %2 (msg=%3) (ec=%4)",
"variables": [
"PUT",
"v11/bulkadd",
"Payload Limit Reached, reduce payload:Payload limit of 30 reached, please reduce payload.",
"ERR.5.4.6147"
]
}
}
}
6 Comments
Chandrashekhar Thakare
Venkata Harish Kajur Can we use the PATCH API operation inside Bulk API?
William Reehil
yes you can, thanks
Chandrashekhar Thakare
Could you please share the working sample request ? I have tried lot of permutation and combinations of headers but it is not working.. Can you share sample Curl for bulkadd API with PATCH?
William Reehil
you cannot do a patch in bulkadd use bulkprocess endpoint
William Reehil
bulkadd can only do puts, if you require patch or delete use bulkprocess
Chandrashekhar Thakare
Thanks it seems working with bulkprocess API.