PATCH
/v2/api/corporate/expenseCode/bulk
Use this Api to add or remove expense code allocations in bulk.
Name | Data Type | Description | Type | Remark |
---|---|---|---|---|
expense_code | string | Expense Code Name | Payload | Mandatory |
expense_code_creation_level | string | Expense Code level | Payload | Mandatory |
expense_code_created_for | string | Expense Code Created For | Payload | Mandatory |
operation | string | Add or Remove | Payload | Mandatory (only add or remove values allowed) |
PATCH
https://devapi.olacabs.com/v2/api/corporate/expenseCode/bulk
[
{
"expense_code": "test45",
"expense_code_creation_level": "EMPLOYEE",
"expense_code_created_for": "xyz@corporate_partners.com",
"operation": "add"
},
{
"expense_code": "test45",
"expense_code_creation_level": "GROUP",
"expense_code_created_for": "Default Test Group",
"operation": "remove"
},
{
"expense_code": "test45",
"expense_code_creation_level": "GROUP",
"expense_code_created_for": "GROUP1",
"operation": "add"
}
]
Headers: {
X-CORPORATE-TOKEN: fd5d4d3726121212f12ff12f12f1f12f1f12fa
}
{
"failed_scopes": 1,
"successful scopes": 2,
"response": [
{
"entity_type": "EMPLOYEE",
"entity_created_as": "xyz@corporate_partners.com",
"message": "scope successfully added to the given expense code",
"operation_success": true
},
{
"entity_type": "GROUP",
"entity_created_as": "Default Test Group",
"message": "scope could not be removed from the given expense code",
"operation_success": false
},
{
"entity_type": "GROUP",
"entity_created_as": "GROUP1",
"message": "scope successfully added to the given expense code",
"operation_success": true
}
]
}
Error Scenarios:
Request:
[
{
"expense_code": "Expense Code 34",
"expense_code_creation_level": "EMPLOYEE",
"expense_code_created_for": "testuser@mailinator.com",
"operation": "add"
},
{
"expense_code": "Expense Code 34",
"expense_code_creation_level": "EMPLOYEE",
"expense_code_created_for": "testuser@mail@inator.com",
"operation": "add"
},
{
"expense_code": "Expense Code 34",
"expense_code_creation_level": "EMPLOYEE1",
"expense_code_created_for": "testuser@mail@inator.com",
"operation": "add"
},
{
"expense_code": "Expense Code 34",
"expense_code_creation_level": null,
"expense_code_created_for": "testuser@mail@inator.com",
"operation": "add"
},
{
"expense_code": "Expense Code 342",
"expense_code_creation_level": "EMPLOYEE",
"expense_code_created_for": "testuser@mail@inator.com",
"operation": "add"
},
{
"expense_code": "Expense Code 34",
"expense_code_creation_level": "EMPLOYEE",
"expense_code_created_for": "testuser@mailinator.com",
"operation": "push"
},
{
"expense_code": "Expense Code 34",
"expense_code_creation_level": "EMPLOYEE",
"expense_code_created_for": null,
"operation": "add"
},
{
"expense_code": "Expense Code 34",
"expense_code_creation_level": "EMPLOYEE",
"expense_code_created_for": "testuser@mailinator.com",
"operation": null
},
{
"expense_code": "Expense Code 34",
"expense_code_creation_level": "GROUP",
"expense_code_created_for": null,
"operation": "add"
},
{
"expense_code": "Expense Code 34",
"expense_code_creation_level": "GROUP",
"expense_code_created_for": "invalid group",
"operation": "add"
}
]
Response:
{
"successful_scope_assignments": 0,
"failed_scopes_assignments": 10,
"response": [
{
"entity_type": "EMPLOYEE",
"entity_created_as": "testuser@mailinator.com",
"message": "the scope already exists in the given expense\ncode",
"operation_success": false
},
{
"entity_type": "EMPLOYEE",
"entity_created_as": "testuser@mail@inator.com",
"message": "Email Id is invalid",
"operation_success": false
},
{
"entity_type": "EMPLOYEE1",
"entity_created_as": "testuser@mail@inator.com",
"message": "Invalid Expense code Creation Level",
"operation_success": false
},
{
"entity_type": null,
"entity_created_as": null,
"message": "expenseCodeCreationLevel may not be null; ",
"operation_success": false
},
{
"entity_type": "EMPLOYEE",
"entity_created_as": "testuser@mail@inator.com",
"message": "Expense code not found",
"operation_success": false
},
{
"entity_type": "EMPLOYEE",
"entity_created_as": "testuser@mailinator.com",
"message": "operation can only be add or remove",
"operation_success": false
},
{
"entity_type": "EMPLOYEE",
"entity_created_as": "NA",
"message": "Email Id is invalid",
"operation_success": false
},
{
"entity_type": null,
"entity_created_as": null,
"message": "operation may not be null; ",
"operation_success": false
},
{
"entity_type": "GROUP",
"entity_created_as": "NA",
"message": "Corporate Group doesn't exist",
"operation_success": false
},
{
"entity_type": "GROUP",
"entity_created_as": "invalid group",
"message": "Corporate Group doesn't exist",
"operation_success": false
}
]
}