You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »


Please note documentation for these APIs can also be accessed via the swagger document

The way to access this would be to visit <server>/swagger/?url=apidocs/aai_swagger_bulk_v15.yaml 

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.


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
{
    "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.


Operation Limit Reached Add
{
    "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"
            ]
        }
    }
}
  • No labels