CreateActivityForUserWithNumbers
Creates a new activity (fee) for a specific user. This mutation allows tracking time spent on various tasks & cost recovery records across matters and phases, with support for both billable and non-billable entries.
Mutation Structure
Mutation Name: CreateActivityForUserWithNumbers
Input Type: CreateActivityForUserWithNumbers! - Required input object
Return Type: Activity - The created activity object
Input Parameters
The mutation requires a CreateActivityForUserWithNumbers input object with the following fields:
UserEmail: String! - Email address of the user for which the activity is assignedApplicableDate: String! - Date when the activity occurred (format: YYYY-MM-DD)MatterNumber: String! - Reference number of the matterMatterPhaseNumber: String! - Reference number of the matter phaseActivityTypeNumber: String! - Reference number of the activity typeUnitNumber: String! - Reference number of the unit (e.g. hours, pages)Description: String! - Detailed description of the activity performedBillableQuantity: Float! - Number of billable units spentNonBillableQuantity: Float! - Number of non-billable units spent
Example Usage
cURL
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"query": "mutation CreateActivity($input: CreateActivityForUserWithNumbers!) { CreateActivityForUserWithNumbers(createActivityForUserWithNumbers: $input) { Id } }",
"variables": {
"input": {
"UserEmail": "john.doe@company.com",
"ApplicableDate": "2023-11-15",
"MatterNumber": "MAT-2023-001",
"MatterPhaseNumber": "PH-2023-001-A",
"ActivityTypeNumber": "ACT-001",
"UnitNumber": "UNIT-001",
"Description": "Conducted legal research on corporate restructuring regulations",
"BillableQuantity": 3.5,
"NonBillableQuantity": 1.0
}
}
}' \
https://sandbox.drivepractice.com/api/v1/graphqlExample Response
Success Response
{
"data": {
"CreateActivityForUserWithNumbers": {
"Id": "5f8d0d5a7b3e4f1234567897"
}
}
}Response with Full Activity Details
To retrieve more details about the created activity, you can request additional fields:
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"query": "mutation CreateActivity($input: CreateActivityForUserWithNumbers!) { CreateActivityForUserWithNumbers(createActivityForUserWithNumbers: $input) { Id } }",
"variables": {
"input": {
"UserEmail": "john.doe@company.com",
"ApplicableDate": "2023-11-15",
"MatterNumber": "MAT-2023-001",
"MatterPhaseNumber": "PH-2023-001-A",
"ActivityTypeNumber": "ACT-001",
"UnitNumber": "UNIT-001",
"Description": "Conducted legal research on corporate restructuring regulations",
"BillableQuantity": 3.5,
"NonBillableQuantity": 1.0
}
}
}' \
https://sandbox.drivepractice.com/api/v1/graphqlError Handling
Common Error Responses
Missing Required Fields:
{
"errors": [
{
"message": "Field 'UserEmail' of required type 'String!' was not provided.",
"locations": [
{
"line": 2,
"column": 3
}
],
"extensions": {
"code": "GRAPHQL_VALIDATION_FAILED"
}
}
]
}Invalid Email Format:
{
"errors": [
{
"message": "UserEmail must be a valid email address",
"extensions": {
"code": "BAD_USER_INPUT"
}
}
]
}Unauthorized Access:
{
"errors": [
{
"message": "Unauthorized",
"extensions": {
"code": "UNAUTHENTICATED"
}
}
]
}Server Error:
{
"errors": [
{
"message": "Internal server error",
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
}
}
]
}Best Practices
- Date Format: Always use ISO 8601 format (YYYY-MM-DD) for the
ApplicableDatefield - Time Tracking: Ensure that
BillableQuantityandNonBillableQuantityare non-negative numbers - Descriptions: Provide detailed descriptions for better time tracking and reporting
- Error Handling: Implement proper error handling in your client applications to handle validation errors gracefully
- Authentication: Always include a valid authorization token in the request headers
Validation Rules
- All fields in the input object are required (marked with
!) UserEmailmust be a valid email formatApplicableDatemust be a valid dateBillableQuantityandNonBillableQuantitymust be non-negative numbers- The user must have appropriate permissions to create activities