### Example Response for Get All Resources Source: https://context7.com/hubplanner/api/llms.txt An example JSON response for the 'Get All Resources' endpoint, illustrating the structure of a resource object, including ID, contact information, status, role, custom fields, and metadata. ```json [{ "_id": "5ba09b635ff58f149a2cf4e7", "email": "john.doe@company.com", "firstName": "John", "lastName": "Doe", "status": "STATUS_ACTIVE", "role": "ROLE_TEAM", "isProjectManager": false, "resourceRates": { "external": [ { "defaultRateId": "5ba09b645ff58f1455552222", "effectiveFrom": "2024-01-01 09:00", "effectiveTo": "2024-12-31 18:00" } ] }, "customFields": [], "metadata": "Senior Developer" }] ``` -------------------------------- ### Example Response for Get All Bookings Source: https://context7.com/hubplanner/api/llms.txt An example JSON response for the 'Get All Bookings' endpoint, showing the structure of a booking object. It includes booking ID, resource and project identifiers, start and end dates, state, and details about the allocation. ```json [ { "_id": "5b1977ade02d407011112222", "resource": "5ae1d7a2d61e560c11112222", "project": "5b06b094562dc80c11112222", "start": "2024-01-22T09:00", "end": "2024-01-26T18:00", "state": "STATE_DAY_MINUTE", "stateValue": 480, "allDay": true, "categoryName": "Development", "bookingCreatorId": "5aa0f2414a576d0c11112222", "details": { "workDaysCount": 5, "bookedMinutes": 2400 }, "createdDate": "2024-01-15T09:30:00.000Z" } ] ``` -------------------------------- ### Get All Resources - Server Response Example (JSON) Source: https://github.com/hubplanner/api/blob/master/Sections/resource.md This is an example of the server's response when the GET /resource endpoint is called. It returns a JSON array containing a single resource object. Each resource object includes properties like _id, email, firstName, lastName, status, role, links, billing details, and resource rates. ```json [ { "_id": "5ba09b635ff58f149a2cf4e7", "email": "wojciech.bator@hubplanner.com", "metadata": "", "createdDate": "2018-09-18T06:24:25.297Z", "updatedDate": null, "note": "", "firstName": "First Name", "lastName": "Last Name", "status": "STATUS_ACTIVE", "role": "ROLE_OWNER", "isProjectManager": false, "links": { "iconLink5": "fa-link", "link5": "", "iconLink4": "fa-link", "link4": "", "iconLink3": "fa-link", "link3": "", "iconLink2": "fa-link", "link2": "", "iconLink1": "fa-link", "link1": "" }, "billing": { "useDefault": false, "id": null, "rate": 0 }, "customFields": [], "useCustomAvailability": false, "resourceRates": { "external": [ { "defaultRateId": "5ba09b645ff58f1455552222", "effectiveFrom": "2018-09-20 09:00", "effectiveTo": "2018-10-30 18:00" } ], "internal": [ { "defaultRateId": "5ba09b645ff58f1455552223", "effectiveFrom": "2018-09-20 09:00", "effectiveTo": "2018-10-30 18:00" } ] }, "calendarIds": [] } ] ``` -------------------------------- ### Example Response for Create Resource Source: https://context7.com/hubplanner/api/llms.txt An example JSON response when creating a new resource. It confirms the creation with the resource's ID, name, email, status, role, and the date it was created. ```json { "_id": "65a4c3d56ff58f149a2cf555", "firstName": "Jane", "lastName": "Smith", "email": "jane.smith@company.com", "status": "STATUS_ACTIVE", "role": "ROLE_TEAM", "createdDate": "2024-01-15T11:45:00.000Z" } ``` -------------------------------- ### Webhook Payload Example (booking.create) Source: https://context7.com/hubplanner/api/llms.txt An example of the JSON payload structure for a 'booking.create' webhook event. ```APIDOC ## Webhook Payload Example (booking.create) ### Description An example of the JSON payload structure for a 'booking.create' webhook event. ### Response Example ```json { "event": "booking.create", "bookingId": "5b1977ade02d407011112222", "resourceId": "5ae1d7a2d61e560c11112222", "projectId": "5b06b094562dc80c11112222", "projectName": "Mobile App Development", "resourceName": "John Doe", "bookingCreatorName": "Jane Smith", "bookingCreatorId": "5aa0f2414a576d0c11112222", "start": { "formatted": "Jan 22nd 2024", "date": "2024-01-22T09:00:00.000Z", "year": "2024", "month": "Jan", "day": "22nd" }, "end": { "formatted": "Jan 26th 2024", "date": "2024-01-26T18:00:00.000Z", "year": "2024", "month": "Jan", "day": "26th" }, "categoryName": "Development", "duration": "40 hrs", "durationMinutes": 2400 } ``` ``` -------------------------------- ### Example Response for Search Resources Source: https://context7.com/hubplanner/api/llms.txt An example JSON response for the 'Search Resources' endpoint. It returns a list of resources that match the specified search criteria, including their ID, name, email, status, and role. ```json [ { "_id": "5ba09b635ff58f149a2cf4e7", "firstName": "John", "lastName": "Doe", "email": "john.doe@company.com", "status": "STATUS_ACTIVE", "role": "ROLE_TEAM" } ] ``` -------------------------------- ### Example Response for Create Booking Source: https://context7.com/hubplanner/api/llms.txt An example JSON response upon successfully creating a booking. It returns the unique ID of the booking, along with the details provided in the request, such as resource, project, dates, state, and calculated duration. ```json { "_id": "65a5d4e67ff58f149a2cf666", "resource": "5ae1d7a2d61e560c11112222", "project": "5b06b094562dc80c11112222", "start": "2024-02-05T09:00", "end": "2024-02-16T18:00", "state": "STATE_DAY_MINUTE", "stateValue": 480, "details": { "workDaysCount": 10, "bookedMinutes": 4800 }, "createdDate": "2024-01-15T15:20:00.000Z" } ``` -------------------------------- ### Webhook Response Example (JSON) Source: https://github.com/hubplanner/api/blob/master/Sections/webhooks.md An example of the response received after successfully creating a webhook subscription. It includes a unique ID, company ID, creation date, and subscription details. ```json { "_id": "448847eea20e6d05bc53a49a", "companyId": "59841c04844e6738c8d45123", "creationDate": "2017-06-01T10:56:34.088Z", "target_url": "http://mydomain.hubplanner.com/webhooks_listener", "event": "project.update", "authorization_token": "secret-token-123" } ``` -------------------------------- ### Example Custom Field Template Structure Source: https://github.com/hubplanner/api/blob/master/Sections/resource.md Illustrates the JSON structure of a single custom field template. This includes metadata like label, type, category, and specific configurations for different field types, such as 'choices' for select or checkbox fields. ```json { "_id": 1234567890, "filterGrid": true, "deleted": false, "company": 1234567890, "label": "select field example", "instructions": "", "defaultValue": "", "defaultRadioId": "", "placeholderText": "", "createdDate": "2017-07-18T09:02:53.016Z", "choices": [ { "value": "first choice", "_id": 1234567890 }, { "value": "second choice", "_id": 1234567890 }, { "value": "third choice", "_id": 1234567890 } ], "canResourceEdit": false, "type": "SELECT", "category": "PROJECT", "status": "ACTIVE", "__v": 8, "allowMultipleValues": false, "characterLimit": 0, "maxValue": 0, "minValue": 0, "order": 5, "stepValue": 0, "updatedDate": "2017-07-18T09:04:22.152Z", "weekStartOn": 1 } ``` -------------------------------- ### Search Resources by Status Source: https://github.com/hubplanner/api/blob/master/Sections/resource.md Provides examples of searching for resources based on their status. It shows how to include specific statuses using `$in` and exclude statuses using `$nin`. The `resource/search` endpoint is used. ```json { "status" : "STATUS_ACTIVE" } ``` ```json { "status" : { "$nin": "STATUS_ACTIVE" } } ``` ```json { "status" : { "$in": ["STATUS_ACTIVE", "STATUS_ARCHIVED"] } } ``` -------------------------------- ### GET /resource Source: https://github.com/hubplanner/api/blob/master/Sections/resource.md Retrieves a list of all resources available in the system. The response includes detailed information for each resource. ```APIDOC ## GET /resource ### Description Retrieves all resources from the system. This endpoint returns an array of resource objects, each containing detailed information such as ID, email, names, status, roles, and associated links and billing information. ### Method GET ### Endpoint /resource ### Parameters #### Query Parameters - **sort** (string) - Optional - Allows sorting of the resource list based on specified fields. ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **_id** (string) - ID of the Resource. - **email** (string) - Resource Email (Unique). - **metadata** (string) - Custom Field (255 Characters). - **createdDate** (string) - Resource Creation Date. - **updatedDate** (string) - Resource Updated Date. - **note** (string) - Resource Notes. - **firstName** (string) - Resource First Name. - **lastName** (string) - Resource Last Name. - **status** (string) - Resource Status. - **role** (string) - Resource Role. - **isProjectManager** (boolean) - Indicates if the resource is a project manager. - **links** (object) - Resource Links. - **billing** (object) - Resource Billing Options (deprecated, use `resourceRates` instead). - **useCustomAvailability** (boolean) - Indicates if custom availability is used. - **customFields** (object array) - Custom Fields associated with the resource. - **resourceRates** (object) - Reference to billing rates for the resource. - **calendarIds** (object array) - Calendar IDs associated with the resource. #### Response Example ```json [ { "_id": "5ba09b635ff58f149a2cf4e7", "email": "wojciech.bator@hubplanner.com", "metadata": "", "createdDate": "2018-09-18T06:24:25.297Z", "updatedDate": null, "note": "", "firstName": "First Name", "lastName": "Last Name", "status": "STATUS_ACTIVE", "role": "ROLE_OWNER", "isProjectManager": false, "links": { "iconLink5": "fa-link", "link5": "", "iconLink4": "fa-link", "link4": "", "iconLink3": "fa-link", "link3": "", "iconLink2": "fa-link", "link2": "", "iconLink1": "fa-link", "link1": "" }, "billing": { "useDefault": false, "id": null, "rate": 0 }, "customFields": [], "useCustomAvailability": false, "resourceRates": { "external": [{ "defaultRateId": "5ba09b645ff58f1455552222", "effectiveFrom": "2018-09-20 09:00", "effectiveTo": "2018-10-30 18:00" }], "internal": [{ "defaultRateId": "5ba09b645ff58f1455552223", "effectiveFrom": "2018-09-20 09:00", "effectiveTo": "2018-10-30 18:00" }] }, "calendarIds": [] } ] ``` ``` -------------------------------- ### POST /booking (Request) Source: https://github.com/hubplanner/api/blob/master/Sections/bookings.md Create a new booking request. Requires the resource request extension to be installed. The booking object is the same, but the `type` field should be set to `WAITING_FOR_APPROVAL`. ```APIDOC ## Create a new Booking Request ### Description To create a new booking request you need to make sure you have the resource request extension installed. The booking object is the same, you only need to pass in a type of `WAITING_FOR_APPROVAL` to make the booking a request. ### Method POST ### Endpoint `/booking` ### Parameters #### Request Body - **resource** (string) - Required - The ID of the resource for the booking request. - **start** (string) - Required - The start date/time of the booking request (YYYY-MM-DD). - **end** (string) - Required - The end date/time of the booking request (YYYY-MM-DD). - **project** (string) - Required - The ID of the project the booking request belongs to. - **type** (string) - Required - Set to `"WAITING_FOR_APPROVAL"` to create a booking request. - **state** (string) - Optional - The state of the booking request. - **stateValue** (number) - Optional - The value associated with the state. ### Request Example ```json { "resource" : "5992a4a6e333b50c3c721c51", "start" : "2023-11-03", "end" : "2023-11-19", "project" : "5992a4a6e583b5333c721c6d", "type" : "WAITING_FOR_APPROVAL" } ``` ### Response #### Success Response (200) - **bookingRequest** (object) - The newly created booking request object. #### Response Example ```json { "_id": "newRequesttId456", "resource": "5992a4a6e333b50c3c721c51", "start": "2023-11-03T09:00:00Z", "end": "2023-11-19T17:00:00Z", "project": "5992a4a6e583b5333c721c6d", "type": "WAITING_FOR_APPROVAL" } ``` ``` -------------------------------- ### User Agent Identification Example Source: https://github.com/hubplanner/api/blob/master/README.md Provides an example of a User-Agent string to identify your application when making API requests. This is a courtesy to help prevent abuse and potential blocking of API access. ```HTTP User-Agent: My Hub Planner Import App (my-name@my-email.com) ``` -------------------------------- ### Webhook Payload Example for booking.create Event Source: https://context7.com/hubplanner/api/llms.txt An example of the JSON payload that will be sent to your webhook endpoint when a new booking is created. This payload contains detailed information about the booking event. ```json { "event": "booking.create", "bookingId": "5b1977ade02d407011112222", "resourceId": "5ae1d7a2d61e560c11112222", "projectId": "5b06b094562dc80c11112222", "projectName": "Mobile App Development", "resourceName": "John Doe", "bookingCreatorName": "Jane Smith", "bookingCreatorId": "5aa0f2414a576d0c11112222", "start": { "formatted": "Jan 22nd 2024", "date": "2024-01-22T09:00:00.000Z", "year": "2024", "month": "Jan", "day": "22nd" }, "end": { "formatted": "Jan 26th 2024", "date": "2024-01-26T18:00:00.000Z", "year": "2024", "month": "Jan", "day": "26th" }, "categoryName": "Development", "duration": "40 hrs", "durationMinutes": 2400 } ``` -------------------------------- ### Create Hourly Booking - Bash Source: https://context7.com/hubplanner/api/llms.txt Creates a booking for a specific resource and project within a single day, specifying start and end times. Requires resource, project, start, and end date-time, along with 'allDay' set to false and a 'state'. ```bash curl -X POST "https://api.hubplanner.com/v1/booking" \ -H "Authorization: your-api-key" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "resource": "5ae1d7a2d61e560c11112222", "project": "5b06b094562dc80c11112222", "start": "2024-01-25 10:00", "end": "2024-01-25 15:00", "allDay": false, "state": "STATE_DAY_MINUTE", "note": "Client meeting and presentation" }' ``` -------------------------------- ### API Sorting Example (Descending by Name) Source: https://github.com/hubplanner/api/blob/master/Sections/README.md Shows how to sort API results using the 'sort' parameter. Prefixing a field with a minus sign sorts in descending order. This example sorts project groups by name in descending order. ```http GET /projectGroup?sort=-name ``` -------------------------------- ### Get All Projects with Hub Planner API Source: https://context7.com/hubplanner/api/llms.txt Retrieves all projects from the Hub Planner account, including details like budget, billing rates, assigned resources, and custom fields. This endpoint uses a GET request and requires an API key for authorization. The response is a JSON array of project objects. ```bash curl -X GET "https://api.hubplanner.com/v1/project" \ -H "Authorization: your-api-key" \ -H "Accept: application/json" \ -H "Content-Type: application/json" ``` ```json [ { "_id": "5ba09b645ff58f149a2cf521", "name": "Website Redesign Project", "projectCode": "WEB-2024", "status": "STATUS_ACTIVE", "budgetHours": 200, "budgetCashAmount": 25000, "budgetCurrency": "USD", "start": "2024-01-15", "end": "2024-06-30", "useProjectDuration": true, "resources": ["5ba09b645ff58f149a2c2222", "5ba09b645ff58f149a2c3333"], "projectManagers": ["5ba09fc85ff58f149a2c2222"], "backgroundColor": "#81A489", "customFields": [], "projectRate": { "external": { "defaultRateId": "5ba09b645ff58f1455552222" } } } ] ``` -------------------------------- ### API Sorting Example (Chained) Source: https://github.com/hubplanner/api/blob/master/Sections/README.md Illustrates chaining multiple 'sort' parameters for complex sorting. This example first sorts by 'groupType' in descending order, then by 'name' in ascending order within each group type. ```http GET /projectGroup?sort=-groupType&sort=name ``` -------------------------------- ### Get All Project Tags Source: https://github.com/hubplanner/api/blob/master/Sections/project.md Retrieves a list of all tags associated with a specific project. ```APIDOC ## Get all Project Tags Use the following command to get a list of project tags. **Method:** GET **Endpoint:** `/project/{projectId}/tag` **Parameters:** #### Path Parameters - **`projectId`** (string) - Required - The ID of the project for which to retrieve tags. ### Response #### Success Response (200) - Returns an array of tag objects, each containing `tagId`, `value`, and `_id`. ### Response Example ```json [ { "tagId": "5bb1e49065e0555544443333", "value": "scala", "_id": "5bbcaa1ae9fcfa1a87cd5f0e" } ] ``` ``` -------------------------------- ### Retrieve Paginated Bookings (GET /booking?page=0&limit=20) Source: https://github.com/hubplanner/api/blob/master/Sections/bookings.md This example demonstrates how to paginate the results for the 'Get All Bookings' endpoint. The 'page' parameter specifies the page number (starting from 0), and the 'limit' parameter defines the number of bookings to return per page. ```HTTP GET /booking?page=0&limit=20 ``` -------------------------------- ### Create a New Project Source: https://context7.com/hubplanner/api/llms.txt Create a project with name, budget, dates, and assigned resources. ```APIDOC ## POST /v1/project ### Description Create a project with name, budget, dates, and assigned resources. ### Method POST ### Endpoint /v1/project ### Parameters #### Request Body - **name** (string) - Required - Name of the project - **projectCode** (string) - Optional - Unique code for the project - **status** (string) - Optional - Initial status of the project (e.g., `STATUS_ACTIVE`, `STATUS_PLANNED`) - **budgetHours** (integer) - Optional - Total budgeted hours for the project - **budgetCashAmount** (number) - Optional - Total budgeted cash amount for the project - **budgetCurrency** (string) - Optional - Currency of the budget amount - **useProjectDuration** (boolean) - Optional - Whether to use project duration for calculations - **start** (string) - Optional - Project start date (YYYY-MM-DD) - **end** (string) - Optional - Project end date (YYYY-MM-DD) - **backgroundColor** (string) - Optional - Hex color code for project visualization - **timeEntryEnabled** (boolean) - Optional - Whether time entry is enabled for the project - **timeEntryApproval** (boolean) - Optional - Whether time entry requires approval for the project ### Request Example ```bash curl -X POST "https://api.hubplanner.com/v1/project" -H "Authorization: your-api-key" -H "Accept: application/json" -H "Content-Type: application/json" -d '{ "name": "Mobile App Development", "projectCode": "MOB-2024-01", "status": "STATUS_ACTIVE", "budgetHours": 500, "budgetCashAmount": 75000, "budgetCurrency": "USD", "useProjectDuration": true, "start": "2024-02-01", "end": "2024-08-31", "backgroundColor": "#4A90E2", "timeEntryEnabled": true, "timeEntryApproval": true }' ``` ### Response #### Success Response (200 or 201) - **_id** (string) - Unique identifier for the newly created project - **name** (string) - Name of the project - **projectCode** (string) - Unique code for the project - **status** (string) - Current status of the project - **budgetHours** (integer) - Total budgeted hours for the project - **budgetCashAmount** (number) - Total budgeted cash amount for the project - **budgetCurrency** (string) - Currency of the budget amount - **createdDate** (string) - Date and time the project was created #### Response Example ```json { "_id": "65a3b2c45ff58f149a2cf999", "name": "Mobile App Development", "projectCode": "MOB-2024-01", "status": "STATUS_ACTIVE", "budgetHours": 500, "budgetCashAmount": 75000, "budgetCurrency": "USD", "createdDate": "2024-01-15T10:30:00.000Z" } ``` ``` -------------------------------- ### Search Bookings by Date Range Source: https://github.com/hubplanner/api/blob/master/Sections/bookings.md Query bookings within a specified date range. This example demonstrates filtering bookings that end before a certain date (`$lt`) and start on or after another date (`$gte`). ```json { "start": {"$lt": "2014-07-15"}, "end":{"$gte": "2014-07-01"} } ``` -------------------------------- ### Project Budget Settings API Source: https://github.com/hubplanner/api/blob/master/Sections/project.md This section covers how to set budget parameters for a project, including budget in hours, cash amount, and currency. It also describes the legacy method using the `budget` object. ```APIDOC ## Project Budget Settings ### Description Configure budget settings for a project, including budget in hours and cash. This section also details the deprecated method for setting budgets using the `budget` object. ### Method PUT (Assumed, as it modifies project settings) ### Endpoint `/hubplanner/api/projects/{projectId}` (Assumed endpoint for project updates) ### Parameters #### Request Body - **budgetHours** (number) - Optional - Budget in hours. Set to 0 to disable. - **budgetCashAmount** (number) - Optional - Budget in cash amount. Set to 0 to disable. - **budgetCurrency** (string) - Optional - The currency for the budget cash amount (e.g., "USD"). - **budget** (object) - Deprecated. Object for legacy budget settings. - **hasBudget** (boolean) - Deprecated. Indicates if the project has a budget. - **projectHours** (object) - Deprecated. Budget in hours. - **active** (boolean) - Deprecated. Whether project hours budget is active. - **hours** (number) - Deprecated. The number of hours budgeted. - **cashAmount** (object) - Deprecated. Budget in cash amount. - **active** (boolean) - Deprecated. Whether cash amount budget is active. - **amount** (number) - Deprecated. The budgeted cash amount. - **currency** (string) - Deprecated. The currency of the cash amount. - **billingRate** (object) - Deprecated. Billing rate details for cash budget. - **useDefault** (boolean) - Deprecated. Whether to use the default billing rate. - **rate** (number) - Deprecated. The custom rate. - **id** (string or null) - Deprecated. The ID of the billing rate. ### Request Example ```json { "budgetHours": 200, "budgetCashAmount": 8000, "budgetCurrency": "USD" } ``` ```json { "budget": { "hasBudget": false, "projectHours": { "active": false, "hours": 200 }, "cashAmount": { "active": false, "amount": 8000, "currency": "USD", "billingRate": { "useDefault": false, "rate": 0, "id": null } } } } ``` ### Response #### Success Response (200) - **budgetHours** (number) - The configured budget in hours. - **budgetCashAmount** (number) - The configured budget in cash amount. - **budgetCurrency** (string) - The configured budget currency. - **budget** (object) - The full budget object, including legacy fields if used. #### Response Example ```json { "budgetHours": 200, "budgetCashAmount": 8000, "budgetCurrency": "USD", "budget": { "hasBudget": true, "projectHours": { "active": true, "hours": 200 }, "cashAmount": { "active": true, "amount": 8000, "currency": "USD", "billingRate": { "useDefault": false, "rate": 80, "id": "5ba09b645ff58f1455552222" } } } } ``` ``` -------------------------------- ### POST /hubplanner/api/booking Source: https://github.com/hubplanner/api/blob/master/Sections/bookings.md Creates a new booking in the hours view. Requires resource, start, end, project, allDay, and state. Can optionally include allowOverschedule. ```APIDOC ## Create a Booking in Hours View ### Description Creates a new booking in the hours view. Requires resource, start, end, project, allDay, and state. Can optionally include `allowOverschedule` to proceed with over-scheduling if display warnings are enabled. ### Method POST ### Endpoint /hubplanner/api/booking ### Parameters #### Request Body - **resource** (string) - Required - The ID of the resource for the booking. - **start** (string) - Required - The start date and time of the booking (e.g., "2017-08-21 10:00"). - **end** (string) - Required - The end date and time of the booking (e.g., "2017-08-21 15:00"). - **project** (string) - Required - The ID of the project associated with the booking. - **allDay** (boolean) - Required - Set to `false` for bookings with specific hours. - **state** (string) - Required - The state of the booking (e.g., "STATE_DAY_MINUTE"). - **allowOverschedule** (boolean) - Optional - Set to `true` to allow over-scheduling if warnings are enabled. ### Request Example ```json { "resource" : "5992a4a6e333b50c3c721c51", "start" : "2017-08-21 10:00", "end" : "2017-08-21 15:00", "project" : "5992a4a6e583b5333c721c6d", "allDay" : false, "state" : "STATE_DAY_MINUTE", "allowOverschedule": true } ``` ### Response #### Success Response (201) - **_id** (string) - The ID of the newly created booking. #### Response Example ```json { "_id": "new_booking_id", "resource" : "5992a4a6e333b50c3c721c51", "start" : "2017-08-21 10:00", "end" : "2017-08-21 15:00", "project" : "5992a4a6e583b5333c721c6d", "allDay" : false, "state" : "STATE_DAY_MINUTE" } ``` ``` -------------------------------- ### Create Repeating Booking (JSON) Source: https://github.com/hubplanner/api/blob/master/Sections/bookings.md Creates a booking that repeats based on specified intervals and conditions. Example shows a booking repeating weekly for 4 times. ```json { "resource": "6672cb5e6d70d30ed4a30636", "start": "2024-08-06", "end": "2024-08-06", "project": "6672cb5e6d70d30ed4a30693", "repeat": true, "interval": "WEEKLY", "repeatEndsAfterTimes": 4 } ``` -------------------------------- ### API Pagination Example Source: https://github.com/hubplanner/api/blob/master/Sections/README.md Demonstrates how to paginate API results using 'limit' and 'page' URL parameters. The default limit is 0 (unlimited), but it's recommended to implement pagination for future compatibility. Pages are zero-indexed. ```http GET /project?page=0&limit=20 ``` -------------------------------- ### POST /booking Source: https://github.com/hubplanner/api/blob/master/Sections/bookings.md Create a new booking. Minimum required fields are resource, start, end, and project. Optional fields like state and stateValue can be provided. ```APIDOC ## Create a new Booking ### Description Create a new booking. If `stateValue` is not provided, it defaults to zero. If `state` is not provided, the default state configured in the UI (usually `STATE_PERCENTAGE`) will be used. ### Method POST ### Endpoint `/booking` ### Parameters #### Request Body - **resource** (string) - Required - The ID of the resource for the booking. - **start** (string) - Required - The start date/time of the booking (YYYY-MM-DD). - **end** (string) - Required - The end date/time of the booking (YYYY-MM-DD). - **project** (string) - Required - The ID of the project the booking belongs to. - **state** (string) - Optional - The state of the booking (e.g., `STATE_DAY_MINUTE`). Defaults to UI configuration. - **stateValue** (number) - Optional - The value associated with the state (e.g., minutes for `STATE_DAY_MINUTE`). Defaults to 0. ### Request Example Minimum required fields: ```json { "resource" : "5992a4a6e333b50c3c721c51", "start" : "2014-11-03", "end" : "2014-11-19", "project" : "5992a4a6e583b5333c721c6d" } ``` Example with state and stateValue (booking 8 hours): ```json { "resource" : "5992a4a6e333b50c3c721c51", "start" : "2014-11-03", "end" : "2014-11-19", "project" : "5992a4a6e583b5333c721c6d", "state" : "STATE_DAY_MINUTE", "stateValue" : 480 } ``` ### Response #### Success Response (200) - **booking** (object) - The newly created booking object. #### Response Example ```json { "_id": "newBookingId123", "resource": "5992a4a6e333b50c3c721c51", "start": "2014-11-03T09:00:00Z", "end": "2014-11-19T17:00:00Z", "project": "5992a4a6e583b5333c721c6d", "state": "STATE_DAY_MINUTE", "stateValue": 480 } ``` ``` -------------------------------- ### API Rate Limit Headers Example Source: https://github.com/hubplanner/api/blob/master/README.md Demonstrates the response headers provided by the Hub Planner API to inform clients about their current API rate limit status. Includes total limit, reset time, and remaining calls. ```http X-RateLimit-Limit X-RateLimit-Reset X-RateLimit-Remaining ``` -------------------------------- ### POST /hubplanner/api/booking/repeat Source: https://github.com/hubplanner/api/blob/master/Sections/bookings.md Creates or updates a repeating booking. Requires resource, start, end, project, repeat, interval, and repeatEndsAfterTimes. Additional fields for repeat configuration are available. ```APIDOC ## Repeating booking ### Description Creates or updates a repeating booking. This endpoint allows for complex repeating patterns based on intervals and specific dates or weekdays. ### Method POST ### Endpoint /hubplanner/api/booking/repeat ### Parameters #### Request Body - **resource** (string) - Required - The ID of the resource for the booking. - **start** (string) - Required - The start date of the first occurrence (e.g., "2024-08-06"). - **end** (string) - Required - The end date of the first occurrence (e.g., "2024-08-06"). - **project** (string) - Required - The ID of the project associated with the booking. - **repeat** (boolean) - Required - Set to `true` to indicate a repeating booking. - **interval** (string) - Required - The interval for repetition (e.g., "WEEKLY", "MONTHLY", "YEARLY"). - **repeatEndsAfterTimes** (number) - Required - The number of times the booking should repeat. - **repeatOnWeekdays** (object) - Optional - For `WEEKLY` interval. Specify which weekdays to repeat on (e.g., `{ "monday": true, "tuesday": false, ... }`). - **repeatOnDates** (number[]) - Optional - For `MONTHLY` or `YEARLY` intervals. Specify the day(s) of the month/year to repeat on (e.g., `[1, 15]`). - **repeatOnCustom1** (string) - Optional - For `MONTHLY` or `YEARLY` intervals. Specifies which occurrence of the week (e.g., "FIRST", "LAST"). - **repeatOnCustom2** (string) - Optional - For `MONTHLY` or `YEARLY` intervals. Specifies the type of day within the week (e.g., "MONDAY", "DAY", "WEEKDAY"). ### Request Example (Repeat for 4 Consecutive Weeks) ```json { "resource": "6672cb5e6d70d30ed4a30636", "start": "2024-08-06", "end": "2024-08-06", "project": "6672cb5e6d70d30ed4a30693", "repeat": true, "interval": "WEEKLY", "repeatEndsAfterTimes": 4, "repeatOnWeekdays": { "tuesday": true } } ``` ### Response #### Success Response (200 or 201) - **(details of created/updated repeating booking)** #### Response Example ```json { "message": "Repeating booking created successfully.", "bookingIds": ["booking_id_1", "booking_id_2", "booking_id_3", "booking_id_4"] } ``` ``` -------------------------------- ### API Request Headers Example Source: https://github.com/hubplanner/api/blob/master/README.md Illustrates the essential Content-Type and Accept headers required for all requests to the Hub Planner API. These headers ensure that data is exchanged in the expected JSON format. ```http GET resource/123 Accept: application/json Content-Type: application/json ``` -------------------------------- ### Search Custom Fields by Type Source: https://github.com/hubplanner/api/blob/master/Sections/resource.md Illustrates how to search for custom fields using the `project/customField/template/search` endpoint. Examples include filtering by type using `$in` and `$nin`, and filtering by label using `$like`. ```json { "type" : "CHECKBOX" } ``` ```json { "type" : { "$nin": ["CHECKBOX"] } } ``` ```json { "type" : { "$in": ["CHECKBOX", "TEXT"] } } ``` ```json { "label" : { "$like": "Policy" } } ``` ```json { "isRequired" : true } ``` -------------------------------- ### Create New Project with Hub Planner API Source: https://context7.com/hubplanner/api/llms.txt Creates a new project within the Hub Planner platform. Requires project details such as name, budget, dates, and can optionally include assigned resources. Uses a POST request with a JSON payload for the project data. Returns the created project object upon success. ```bash curl -X POST "https://api.hubplanner.com/v1/project" \ -H "Authorization: your-api-key" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "name": "Mobile App Development", "projectCode": "MOB-2024-01", "status": "STATUS_ACTIVE", "budgetHours": 500, "budgetCashAmount": 75000, "budgetCurrency": "USD", "useProjectDuration": true, "start": "2024-02-01", "end": "2024-08-31", "backgroundColor": "#4A90E2", "timeEntryEnabled": true, "timeEntryApproval": true }' ``` ```json { "_id": "65a3b2c45ff58f149a2cf999", "name": "Mobile App Development", "projectCode": "MOB-2024-01", "status": "STATUS_ACTIVE", "budgetHours": 500, "budgetCashAmount": 75000, "budgetCurrency": "USD", "createdDate": "2024-01-15T10:30:00.000Z" } ``` -------------------------------- ### Search Bookings by IDs Source: https://github.com/hubplanner/api/blob/master/Sections/bookings.md Perform complex searches on bookings using various criteria. This example shows how to find bookings by a list of specific IDs using the `$in` operator or exclude bookings by a list of IDs using the `$nin` operator. ```json { "_id": {"$in": ["123", "456", "789"]} } ``` ```json { "_id": {"$nin": ["123", "456", "789"]} } ``` -------------------------------- ### Create a Single Project (JSON) Source: https://github.com/hubplanner/api/blob/master/Sections/project.md Demonstrates the POST request to create a new project. The request body should contain a JSON object with project details, such as the project name. A successful creation returns a 201 Created status and the full project object, including the new ID. ```json {"name": "My First Project"} ``` -------------------------------- ### Create a Booking with Hubplanner API Source: https://context7.com/hubplanner/api/llms.txt Creates a new resource booking (allocation) in the Hubplanner API. This endpoint requires specifying the resource, project, start and end dates, and allocation state (e.g., hours or percentage). Optional fields include notes and category. ```bash curl -X POST "https://api.hubplanner.com/v1/booking" \ -H "Authorization: your-api-key" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "resource": "5ae1d7a2d61e560c11112222", "project": "5b06b094562dc80c11112222", "start": "2024-02-05", "end": "2024-02-16", "state": "STATE_DAY_MINUTE", "stateValue": 480, "note": "Frontend development sprint", "categoryTemplateId": "5aa0f2414a576d0c11112222" }' ``` -------------------------------- ### Get All Bookings with Pagination using Hubplanner API Source: https://context7.com/hubplanner/api/llms.txt Retrieves resource bookings (allocations) from the Hubplanner API with support for pagination. This endpoint allows fetching bookings in pages and limits the number of results per page, with options to sort by start date. ```bash curl -X GET "https://api.hubplanner.com/v1/booking?page=0&limit=20&sort=-start" \ -H "Authorization: your-api-key" \ -H "Accept: application/json" \ -H "Content-Type: application/json" ```