Skip to Content
DeveloperMutationsCreateActivityForUserWithNumbers

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 assigned
  • ApplicableDate: String! - Date when the activity occurred (format: YYYY-MM-DD)
  • MatterNumber: String! - Reference number of the matter
  • MatterPhaseNumber: String! - Reference number of the matter phase
  • ActivityTypeNumber: String! - Reference number of the activity type
  • UnitNumber: String! - Reference number of the unit (e.g. hours, pages)
  • Description: String! - Detailed description of the activity performed
  • BillableQuantity: Float! - Number of billable units spent
  • NonBillableQuantity: Float! - Number of non-billable units spent

Example Usage

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/graphql

Example 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/graphql

Error 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

  1. Date Format: Always use ISO 8601 format (YYYY-MM-DD) for the ApplicableDate field
  2. Time Tracking: Ensure that BillableQuantity and NonBillableQuantity are non-negative numbers
  3. Descriptions: Provide detailed descriptions for better time tracking and reporting
  4. Error Handling: Implement proper error handling in your client applications to handle validation errors gracefully
  5. Authentication: Always include a valid authorization token in the request headers

Validation Rules

  • All fields in the input object are required (marked with !)
  • UserEmail must be a valid email format
  • ApplicableDate must be a valid date
  • BillableQuantity and NonBillableQuantity must be non-negative numbers
  • The user must have appropriate permissions to create activities