Bulk Create, Update, Delete

It is recommended to use Bulk Create, Update, Delete methods when working with a lot of data at once.

Operation NameEndpoint

Create, Update

.*batch-modify

Delete

*.batch-delete

Bulk Create, Update

Pipeliner API supports creating, updating records in one *.batch-modifyrequest

  1. When the ID is specified in an object, it works as an update method

  2. When the ID is not specified in an object, it works as a create method

Snippet

POST /entities/{{Entity-name}}/batch-modify
[
    {"id": "123", "name": "update"}, 
    {"name": "create"}
]

Using Rollback for Bulk operations

Rollback is API parameter, that can help you to rollback data that has failed for some reason (eg. data became invalid).

Example

In this example, we are going to bulk update Accounts, with the rollback method turned on.

Rollback = 0

If at least one object in a request is invalid, any operation isn´t executed (all data are rollbacked)

POST {{baseUrl}}/entities/Accounts/batch-modify?rollback-method=0
[
    {
        "id": "0bc376a4-c579-413a-9221-e86e4a134766",
        "name": "Account - Updated"
    },
    {
        "name": "Account - Created"
    }
]
{
    "code": 40000,
    "name": "ERROR_ENTITY_VALIDATION",
    "message": "\n[owner_id] Relation Account.owner_id=00000000-0000-0000-0000-000000011a3d to Client doesn't exist!",
    "entity_id": "0bc376a4-c579-413a-9221-e86e4a134766",
    "entity_name": "Account",
    "entity_errors": [],
    "field_errors": [
        {
            "field_id": "5b67c561-0136-0c86-9dc0-0b4c9acb42f5",
            "field_name": "owner_id",
            "name": "ERROR_FIELD_VALIDATION",
            "code": 40002,
            "errors": [
                {
                    "code": 120,
                    "name": "ERROR_RELATIONS_DOESNT_EXIST",
                    "message": "[owner_id] Relation Account.owner_id=00000000-0000-0000-0000-000000011a3d to Client doesn't exist!",
                    "field_id": "5b67c561-0136-0c86-9dc0-0b4c9acb42f5",
                    "field_name": "owner_id"
                }
            ]
        }
    ],
    "step_checklist_errors": [],
    "entity_index": null,
    "http_status": 422,
    "success": false
}

Rollback=1

If an object in a request is invalid, it is not saved but other valid records are saved successfully. If the error occurs it is then returned in a response

POST {{baseUrl}}/entities/Accounts/batch-modify?rollback-method=1
[
    {
        "id": "0bc376a4-c579-413a-9221-e86e4a134766",
        "name": "Account - Updated"
    },
    {
        "name": "Account - Created",
        "owner_id": "00000000-0000-0000-0000-000000011a7d"
    }
]
{
    "success": false,
    "data": [
        {
            "code": 40000,
            "name": "ERROR_ENTITY_VALIDATION",
            "message": "\n[owner_id] Relation Account.owner_id=00000000-0000-0000-0000-000000011a3d to Client doesn't exist!"
        },
        "f75fc63f-8c6f-499e-b9d2-ff16bcefdd83"
    ]
}

Last updated