### Local Installation: Uncomment Server Listen Source: https://github.com/planmill/api/blob/master/README.md This JavaScript snippet shows how to uncomment the lines in `server.js` to start the Express web server for local development. Ensure Node.js LTS is installed and dependencies are managed via npm. ```javascript /* start the express web server listening on 3020 app.listen(3020, () => { console.log("listening on 3020"); }); */ ``` -------------------------------- ### Authentication - OAuth 2.0 Setup Source: https://context7.com/planmill/api/llms.txt Guide to setting up OAuth 2.0 authentication for PlanMill API access, including obtaining credentials and access tokens. ```APIDOC ## Authentication - OAuth 2.0 Setup PlanMill uses OAuth 2.0 with OpenID Connect for API authentication. Clients must first register at the registrations page to obtain client credentials, then exchange them for access tokens. ### Method GET, POST ### Endpoint `https://online.planmill.com/{instance}/api/oauth2/authorize` `https://online.planmill.com/{instance}/api/oauth2/token` ### Parameters #### Path Parameters None #### Query Parameters (for authorize) - **client_id** (string) - Required - Your application's client ID. - **redirect_uri** (string) - Required - The callback URL for your application. - **response_type** (string) - Required - Should be `code`. - **scope** (string) - Required - Should be `openid`. #### Request Body (for token) - **grant_type** (string) - Required - Must be `authorization_code`. - **client_id** (string) - Required - Your application's client ID. - **client_secret** (string) - Required - Your application's client secret. - **code** (string) - Required - The authorization code received from the `/authorize` endpoint. - **redirect_uri** (string) - Required - The callback URL for your application. ### Request Example (Authorization Code Grant) ```bash curl -X GET "https://online.planmill.com/{instance}/api/oauth2/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=https://yourapp.com/callback&response_type=code&scope=openid" curl -X POST "https://online.planmill.com/{instance}/api/oauth2/token" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "grant_type=authorization_code" \ -d "client_id=YOUR_CLIENT_ID" \ -d "client_secret=YOUR_CLIENT_SECRET" \ -d "code=AUTHORIZATION_CODE" \ -d "redirect_uri=https://yourapp.com/callback" ``` ### Response #### Success Response (200) - **access_token** (string) - The access token for API requests. - **token_type** (string) - The type of token, usually 'Bearer'. - **expires_in** (integer) - The lifetime of the access token in seconds. - **refresh_token** (string) - The token used to obtain new access tokens. - **id_token** (string) - The OpenID Connect ID token. #### Response Example ```json { "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4...", "id_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." } ``` ``` -------------------------------- ### Java Example for Webhook Creation Source: https://github.com/planmill/api/wiki/WebHooks This Java code snippet, found in the api-data-helper repository, provides an example of how to programmatically create a webhook. It likely involves constructing the necessary HTTP request and handling the response from the Planmill API. ```Java // Code example can be found at: https://github.com/planmill/api-data-helper/blob/master/src/test/java/com/planmill/api/datahelper/test/WebHooks.java ``` -------------------------------- ### Programmatic Access Token Generation Source: https://github.com/planmill/api/wiki/Getting-started Examples and resources for obtaining access tokens programmatically. ```APIDOC ## Programmatic Access Token Generation ### Description Resources for generating PlanMill API access tokens programmatically using various languages. ### Resources #### Java Implementation Example - **Link:** https://github.com/planmill/api-data-helper - **Description:** Provides an implementation example in Java for interacting with the PlanMill API, including token generation. #### Node.js (npm package and example tool) - **OAuth 2.0 npm package:** https://www.npmjs.com/package/planmill-oauth2.0?activeTab=readme - **Example API tool application:** https://github.com/planmill/pm-api-tool - **Description:** Offers an npm package for handling OAuth 2.0 in Node.js applications and a sample tool demonstrating API usage. ``` -------------------------------- ### GET Requests Source: https://github.com/planmill/api/wiki/Supported-HTTP-verbs-and-combining-multiple-requests GET requests are used to retrieve data. They can fetch a collection of resources, often filterable by query parameters, or retrieve all details for a single resource by its ID. ```APIDOC ## GET /timereports ### Description Retrieves a list of timereports. This collection can be filtered using query parameters. ### Method GET ### Endpoint /timereports ### Query Parameters - **project** (string) - Optional - Filters timereports by project. - **rowcount** (integer) - Optional - Specifies the number of timereports to return. ### Response #### Success Response (200) - **Array of timereport objects** (array) - Contains the timereport data. ### Request Example ``` GET /timereports?project=123&rowcount=10 ``` ## GET /timereports/{id} ### Description Retrieves all available information for a single timereport identified by its ID. ### Method GET ### Endpoint /timereports/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the timereport. ### Response #### Success Response (200) - **timereport object** (object) - Contains all attributes of the specified timereport. ### Request Example ``` GET /timereports/123 ``` ``` -------------------------------- ### Product API Source: https://github.com/planmill/api/wiki/API-1.0-compared-to-API-1.5 Provides endpoints for managing products, including getting, deleting, inserting, and updating products. ```APIDOC ## GET /api/product/get ### Description Retrieves a product based on its ID. ### Method GET ### Endpoint /api/product/get ### Parameters #### Query Parameters - **Product.Id** (string) - Optional - The ID of the product to retrieve. ### Response #### Success Response (200) - **product** (object) - Details of the product. ## DELETE /api/product/delete ### Description Deletes a product by its ID. ### Method DELETE ### Endpoint /api/product/delete ### Parameters #### Query Parameters - **Id** (string) - Required - The ID of the product to delete. ## POST /api/product/insert ### Description Inserts a new product. ### Method POST ### Endpoint /api/product/insert ### Parameters #### Request Body - **Fields** (object) - Required - The fields for the new product. ## PUT /api/product/update ### Description Updates an existing product. ### Method PUT ### Endpoint /api/product/update ### Parameters #### Query Parameters - **Id** (string) - Required - The ID of the product to update. #### Request Body - **Fields** (object) - Required - The updated fields for the product. ``` -------------------------------- ### Project API Source: https://github.com/planmill/api/wiki/API-1.0-compared-to-API-1.5 Provides endpoints for managing projects, including getting, deleting, inserting, and updating projects. ```APIDOC ## GET /api/project/get ### Description Retrieves a project based on its ID. ### Method GET ### Endpoint /api/project/get ### Parameters #### Query Parameters - **PMVProject.Id** (string) - Optional - The ID of the project to retrieve. ### Response #### Success Response (200) - **project** (object) - Details of the project. ## DELETE /api/project/delete ### Description Deletes a project by its ID. ### Method DELETE ### Endpoint /api/project/delete ### Parameters #### Query Parameters - **Id** (string) - Required - The ID of the project to delete. ## POST /api/project/insert ### Description Inserts a new project. ### Method POST ### Endpoint /api/project/insert ### Parameters #### Request Body - **Fields** (object) - Required - The fields for the new project. ## PUT /api/project/update ### Description Updates an existing project. ### Method PUT ### Endpoint /api/project/update ### Parameters #### Query Parameters - **Id** (string) - Required - The ID of the project to update. #### Request Body - **Fields** (object) - Required - The updated fields for the project. ``` -------------------------------- ### OAuth 2.0 Access Token Setup (Postman) Source: https://github.com/planmill/api/wiki/Getting-started Instructions for setting up OAuth 2.0 access token in Postman for PlanMill API calls. ```APIDOC ## OAuth 2.0 Access Token Setup (Postman) ### Description Follow these steps to obtain an access token using OAuth 2.0 in Postman for PlanMill API requests. ### Method OAuth 2.0 (Client Credentials Grant Type) ### Endpoint - **Authorization URL:** `https://online.planmill.com/:instance/api/oauth2/authorize` - **Token URL:** `https://online.planmill.com/:instance/api/oauth2/token` ### Parameters #### Request Body (Implicit in Postman UI for OAuth 2.0) - **Client ID** (string) - Required - Client ID obtained from Step 1 (Client Registration). - **Client Secret** (string) - Required - Client Secret obtained from Step 1 (Client Registration). - **Grant Type** (string) - Default: "Client Credentials" *Note: Scope can be left empty as it defaults to "openid".* ### Steps in Postman 1. Navigate to the Authorization tab of your API call. 2. Select "OAuth 2.0" from the Type dropdown. 3. Click "Get new access token". 4. Fill in the "Authorization URL", "Token URL", "Client ID", and "Client Secret". 5. Click "Request token", log in, and authorize the credentials. 6. Select the generated token and click "Add to Header". Postman will automatically add it as a "Bearer" token. ### Access Token Validity Access tokens are valid for 60 minutes. Repeat steps 2-6 to obtain a new token after expiration. ``` -------------------------------- ### Selecting Necessary Fields in GET Requests Source: https://github.com/planmill/api/wiki/Content-and-filters Users can select specific fields to be included in GET request responses for PlanMill modules if this functionality is enabled. This is done via 'Table settings' within the PlanMill UI. ```APIDOC ## Selecting Necessary Fields in GET ### Description Allows users to remove non-required fields from GET request results for PlanMill module tables. This feature must be enabled by PlanMill maintenance. ### Method GET ### Endpoint Corresponds to table endpoints for PlanMill modules (e.g., `/accounts`) ### Usage 1. Log in as an API user. 2. Select a PlanMill module (e.g., Accounts). 3. Choose 'Table settings' in the top right corner of the table. 4. Remove columns corresponding to the desired fields. ### Notes - Removing columns for obligatory fields has no effect. - Selecting columns without corresponding API fields has no effect. - Currently, obligatory fields are not documented. ``` -------------------------------- ### Competence API Source: https://github.com/planmill/api/wiki/API-1.0-compared-to-API-1.5 Provides endpoints for managing competences, including getting, deleting, inserting, and updating competences. ```APIDOC ## GET /api/competence/get ### Description Retrieves a competence based on its ID. ### Method GET ### Endpoint /api/competence/get ### Parameters #### Query Parameters - **Competence.Id** (string) - Optional - The ID of the competence to retrieve. ### Response #### Success Response (200) - **competence** (object) - Details of the competence. ## DELETE /api/competence/delete ### Description Deletes a competence by its ID. ### Method DELETE ### Endpoint /api/competence/delete ### Parameters #### Query Parameters - **Id** (string) - Required - The ID of the competence to delete. ## POST /api/competence/insert ### Description Inserts a new competence. ### Method POST ### Endpoint /api/competence/insert ### Parameters #### Request Body - **Fields** (object) - Required - The fields for the new competence. ## PUT /api/competence/update ### Description Updates an existing competence. ### Method PUT ### Endpoint /api/competence/update ### Parameters #### Query Parameters - **Id** (string) - Required - The ID of the competence to update. #### Request Body - **Fields** (object) - Required - The updated fields for the competence. ``` -------------------------------- ### User API Source: https://github.com/planmill/api/wiki/API-1.0-compared-to-API-1.5 Provides endpoints for managing users, including getting, inserting, and updating users. ```APIDOC ## GET /api/user/get ### Description Retrieves a user based on their ID. ### Method GET ### Endpoint /api/user/get ### Parameters #### Query Parameters - **Person.Id** (string) - Optional - The ID of the user to retrieve. ### Response #### Success Response (200) - **user** (object) - Details of the user. ## POST /api/user/insert ### Description Inserts a new user. ### Method POST ### Endpoint /api/user/insert ### Parameters #### Request Body - **Fields** (object) - Required - The fields for the new user. ## PUT /api/user/update ### Description Updates an existing user. ### Method PUT ### Endpoint /api/user/update ### Parameters #### Query Parameters - **Id** (string) - Required - The ID of the user to update. #### Request Body - **Fields** (object) - Required - The updated fields for the user. ``` -------------------------------- ### Action API Source: https://github.com/planmill/api/wiki/API-1.0-compared-to-API-1.5 Provides endpoints for managing actions, including getting, deleting, inserting, and updating actions. ```APIDOC ## GET /api/action/get ### Description Retrieves an action based on its ID. ### Method GET ### Endpoint /api/action/get ### Parameters #### Query Parameters - **Action.Id** (string) - Optional - The ID of the action to retrieve. ### Response #### Success Response (200) - **action** (object) - Details of the action. ## DELETE /api/action/delete ### Description Deletes an action by its ID. ### Method DELETE ### Endpoint /api/action/delete ### Parameters #### Query Parameters - **Id** (string) - Required - The ID of the action to delete. ## POST /api/action/insert ### Description Inserts a new action. ### Method POST ### Endpoint /api/action/insert ### Parameters #### Request Body - **Fields** (object) - Required - The fields for the new action. ## PUT /api/action/update ### Description Updates an existing action. ### Method PUT ### Endpoint /api/action/update ### Parameters #### Query Parameters - **Id** (string) - Required - The ID of the action to update. #### Request Body - **Fields** (object) - Required - The updated fields for the action. ``` -------------------------------- ### Opportunity API Source: https://github.com/planmill/api/wiki/API-1.0-compared-to-API-1.5 Provides endpoints for managing opportunities, including getting, deleting, inserting, and updating opportunities. Note: API 1.0 does not include Opportunity items. ```APIDOC ## GET /api/opportunity/get ### Description Retrieves an opportunity based on its ID. ### Method GET ### Endpoint /api/opportunity/get ### Parameters #### Query Parameters - **Opportunity.Id** (string) - Optional - The ID of the opportunity to retrieve. ### Response #### Success Response (200) - **opportunity** (object) - Details of the opportunity. ## DELETE /api/opportunity/delete ### Description Deletes an opportunity by its ID. ### Method DELETE ### Endpoint /api/opportunity/delete ### Parameters #### Query Parameters - **Id** (string) - Required - The ID of the opportunity to delete. ## POST /api/opportunity/insert ### Description Inserts a new opportunity. ### Method POST ### Endpoint /api/opportunity/insert ### Parameters #### Request Body - **Fields** (object) - Required - The fields for the new opportunity. ## PUT /api/opportunity/update ### Description Updates an existing opportunity. ### Method PUT ### Endpoint /api/opportunity/update ### Parameters #### Query Parameters - **Id** (string) - Required - The ID of the opportunity to update. #### Request Body - **Fields** (object) - Required - The updated fields for the opportunity. ``` -------------------------------- ### Task API Source: https://github.com/planmill/api/wiki/API-1.0-compared-to-API-1.5 Provides endpoints for managing tasks within a project, including getting, deleting, inserting, and updating tasks. ```APIDOC ## GET /api/task/get ### Description Retrieves tasks, optionally filtered by Task ID, within a project. ### Method GET ### Endpoint /api/task/get ### Parameters #### Query Parameters - **TaskHierarchy.ProjectId** (string) - Required - The ID of the project. - **Task.Id** (string) - Optional - The ID of the task to retrieve. ### Response #### Success Response (200) - **tasks** (array) - An array of task objects. ## DELETE /api/task/delete ### Description Deletes a task from a project. ### Method DELETE ### Endpoint /api/task/delete ### Parameters #### Query Parameters - **TaskHierarchy.ProjectId** (string) - Required - The ID of the project. - **Id** (string) - Required - The ID of the task to delete. ## POST /api/task/insert ### Description Inserts a new task into a project. ### Method POST ### Endpoint /api/task/insert ### Parameters #### Query Parameters - **TaskHierarchy.ProjectId** (string) - Required - The ID of the project. #### Request Body - **Fields** (object) - Required - The fields for the new task. ## PUT /api/task/update ### Description Updates an existing task within a project. ### Method PUT ### Endpoint /api/task/update ### Parameters #### Query Parameters - **TaskHierarchy.ProjectId** (string) - Required - The ID of the project. - **Id** (string) - Required - The ID of the task to update. #### Request Body - **Fields** (object) - Required - The updated fields for the task. ``` -------------------------------- ### POST /timereports Source: https://context7.com/planmill/api/llms.txt Creates a new time report entry. Requires person, project, task, start time, end time, and amount (in minutes). ```APIDOC ## POST /timereports ### Description Creates a new time report entry. Required fields include `person`, `project`, `task`, `start`, `finish`, and `amount` (in minutes). ### Method POST ### Endpoint `/timereports` ### Parameters #### Request Body - **person** (integer) - Required - The ID of the person submitting the time report. - **project** (integer) - Required - The ID of the project the time report is for. - **task** (integer) - Required - The ID of the task the time report is for. - **start** (string) - Required - The start date and time of the work (ISO 8601 format). - **finish** (string) - Required - The end date and time of the work (ISO 8601 format). - **amount** (integer) - Required - The duration of the work in minutes. - **billableStatus** (integer) - Optional - The billable status of the time report. - **status** (integer) - Optional - The status of the time report. - **comment** (string) - Optional - A comment for the time report. ### Request Example ```bash curl -X POST "https://online.planmill.com/{instance}/api/1.5/timereports" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json;charset=UTF-8" -d '{ "person": 356, "project": 1525, "task": 1526, "start": "2024-01-15T09:00:00.000+0200", "finish": "2024-01-15T17:00:00.000+0200", "amount": 480, "billableStatus": 1, "status": 1, "comment": "Development work on feature X" }' ``` ### Response #### Success Response (201 Created) - **id** (integer) - The unique identifier for the newly created time report. #### Response Example ```json { "id": 1529 } ``` ``` -------------------------------- ### GET /opportunities - List Opportunities Source: https://context7.com/planmill/api/llms.txt Retrieves sales opportunities from the CRM module. Opportunities track potential deals through the sales pipeline. ```APIDOC ## GET /opportunities - List Opportunities ### Description Retrieves sales opportunities from the CRM module. Opportunities track potential deals through the sales pipeline. ### Method GET ### Endpoint `/opportunities` ### Parameters #### Query Parameters - **status** (integer) - Required - The status of the opportunities to filter by. - **rowcount** (integer) - Optional - The maximum number of records to return. ### Request Example ```bash curl -X GET "https://online.planmill.com/{instance}/api/1.5/opportunities?status=0&rowcount=50" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json;charset=UTF-8" ``` ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the opportunity. - **subject** (string) - The subject of the opportunity. - **description** (string) - A description of the opportunity. - **project** (integer) - The ID of the project associated with the opportunity. - **request** (integer) - The ID of the related request. - **contact** (integer) - The ID of the contact person. - **responsible** (integer) - The ID of the responsible user. - **campaign** (integer) - The ID of the campaign. - **stage** (integer) - The current stage of the opportunity. - **probability** (integer) - The probability of closing the opportunity. - **priority** (integer) - The priority of the opportunity. - **type** (integer) - The type of opportunity. - **source** (integer) - The source of the opportunity. - **reason** (integer) - The reason for the opportunity. - **status** (integer) - The status of the opportunity. - **competitor** (integer) - The ID of the competitor (if applicable). - **nextStep** (integer) - The ID of the next step in the sales process. - **closed** (string) - The date the opportunity was closed. #### Response Example ```json [ { "id": 1078553, "subject": "Create opportunity", "description": "Opportunity", "project": 1046, "request": 1078552, "contact": 50, "responsible": 356, "campaign": 1529, "stage": 10, "probability": 10, "priority": 2, "type": 0, "source": 0, "reason": 0, "status": 0, "competitor": -1, "nextStep": 0, "closed": "2022-02-17T00:00:00.000+0200" } ] ``` ``` -------------------------------- ### Token Info Endpoint Source: https://github.com/planmill/api/wiki/Security Inspect the details of an access token, including the bound user, scope, audience, and expiration time in seconds. This is a GET request to `/api/oauth2/tokeninfo`. ```APIDOC ## Token Info Endpoint **Endpoint:** `/api/oauth2/tokeninfo` **Method:** GET **Query Parameters:** - **client_id** (string) - Required - Your application's client ID. - **client_secret** (string) - Required - Your application's client secret. - **access_token** (string) - Required - The access token to inspect. **Response Body Example:** ```json { "user": "user_id", "scope": "scope1 scope2", "audience": "audience_id", "expires_in": 3600 } ``` ``` -------------------------------- ### GET /timereports Source: https://context7.com/planmill/api/llms.txt Retrieves time report entries, allowing filtering by date range, project, and person. Time values are returned in minutes. ```APIDOC ## GET /timereports ### Description Retrieves time report entries. Supports interval-based filtering for date ranges. Time values are returned in minutes. ### Method GET ### Endpoint `/timereports` ### Parameters #### Query Parameters - **interval** (string) - Optional - Specifies the interval type for date filtering (e.g., 'start'). - **intervalstart** (string) - Optional - The start date and time for the interval filter (ISO 8601 format). - **intervalfinish** (string) - Optional - The end date and time for the interval filter (ISO 8601 format). - **project** (integer) - Optional - Filters time reports by project ID. - **person** (integer) - Optional - Filters time reports by person ID. - **rowcount** (integer) - Optional - The maximum number of time reports to return. ### Request Example ```bash # Get time reports for a date range curl -X GET "https://online.planmill.com/{instance}/api/1.5/timereports?interval=start&intervalstart=2024-01-01T00:00:00.000%2B0200&intervalfinish=2024-01-31T23:59:59.000%2B0200&rowcount=100" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json;charset=UTF-8" # Filter by project curl -X GET "https://online.planmill.com/{instance}/api/1.5/timereports?project=1525&person=356" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the time report entry. - **person** (integer) - The ID of the person who made the time report. - **project** (integer) - The ID of the project the time report is associated with. - **task** (integer) - The ID of the task the time report is associated with. - **start** (string) - The start date and time of the reported work (ISO 8601 format). - **finish** (string) - The end date and time of the reported work (ISO 8601 format). - **amount** (integer) - The duration of the reported work in minutes. - **billableAmount** (integer|null) - The billable amount in minutes, if applicable. - **billableStatus** (integer) - The billable status of the time report. - **status** (integer) - The status of the time report. - **comment** (string) - A comment associated with the time report. - **overtimeAmount** (integer) - The amount of overtime in minutes. - **overtimeComment** (string) - A comment for overtime. - **travelAmount** (integer) - The amount of travel time in minutes. - **travelComment** (string) - A comment for travel time. - **billingComment** (string|null) - A comment related to billing. #### Response Example ```json [ { "id": 1528, "person": 356, "project": 1525, "task": 1526, "start": "2021-07-03T00:07:00.000+0300", "finish": "2021-07-03T16:47:00.000+0300", "amount": 1000, "billableAmount": null, "billableStatus": 1, "status": 1, "comment": "testing request", "overtimeAmount": 0, "overtimeComment": "", "travelAmount": 0, "travelComment": "", "billingComment": null } ] ``` ``` -------------------------------- ### GET /projects - List Projects Source: https://context7.com/planmill/api/llms.txt Retrieves project data, including details, status, and financial information. Projects are the core work containers in PlanMill. ```APIDOC ## GET /projects - List Projects ### Description Retrieves project data including project details, status, and financial information. Projects are the core work containers in PlanMill. ### Method GET ### Endpoint `/projects` ### Parameters #### Query Parameters - **status** (integer) - Optional - Filter projects by status. - **rowcount** (integer) - Optional - The number of rows to return. ### Request Example ```bash curl -X GET "https://online.planmill.com/{instance}/api/1.5/projects?status=3&rowcount=50" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json;charset=UTF-8" \ -H "x-PlanMill-Currency: EUR" ``` ### Response #### Success Response (200 OK) - The response is an array of project objects, each containing: - **id** (integer) - The project ID. - **name** (string) - The project name. - **operationalId** (string) - The operational ID of the project. - **description** (string) - The project description. - **type** (integer) - The project type. - **category** (integer) - The project category. - **status** (integer) - The project status. - **account** (integer) - The associated account ID. - **contact** (integer) - The associated contact ID. - **portfolio** (integer) - The portfolio ID. - **billableStatus** (integer) - The billable status. - **currency** (integer) - The currency code. - **fixedRevenue** (number) - The fixed revenue. - **fixedWork** (number) - The fixed work hours. - **fixedWorkEffort** (number) - The fixed work effort. - **budgetedTotalCost** (number) - The budgeted total cost. - **budgetedPurchase** (number) - The budgeted purchase cost. - **budgetedExpense** (number) - The budgeted expense cost. - **autoAcceptTimeReports** (integer) - Flag for auto-accepting time reports. - **autoAssignNewTeamMembers** (integer) - Flag for auto-assigning new team members. #### Response Example ```json [ { "id": 584043, "name": "Test Project A", "operationalId": "12779", "description": "
test description
", "type": 1, "category": 30, "status": 3, "account": 558783, "contact": 356, "portfolio": 210, "billableStatus": 2, "currency": 1, "fixedRevenue": 1000, "fixedWork": 100, "fixedWorkEffort": 2250, "budgetedTotalCost": 0, "budgetedPurchase": 100, "budgetedExpense": 100, "autoAcceptTimeReports": 0, "autoAssignNewTeamMembers": 0 } ] ``` ``` -------------------------------- ### GET /accounts/{id} - Get Single Account Source: https://context7.com/planmill/api/llms.txt Retrieves detailed information about a specific account using its ID. Returns all available fields for the account. ```APIDOC ## GET /accounts/{id} - Get Single Account ### Description Retrieves detailed information about a specific account by its ID. Returns all available fields for the account. ### Method GET ### Endpoint `/accounts/{id}` ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the account to retrieve. ### Request Example ```bash curl -X GET "https://online.planmill.com/{instance}/api/1.5/accounts/4635" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json;charset=UTF-8" ``` ### Response #### Success Response (200 OK) - **id** (integer) - The account ID. - **name** (string) - The account name. - **type** (integer) - The account type. - **businessId** (string) - The business ID. - **vatId** (string) - The VAT ID. - **phone** (string) - The phone number. - **email** (string) - The email address. - **invoiceEmail** (string) - The invoice email address. - **website** (string) - The website URL. - **owner** (integer) - The owner's user ID. - **passive** (integer) - Passive status (0 for active, 1 for passive). - **termsOfPayment** (integer) - Terms of payment. - **invoiceChannel** (integer) - Invoice channel. - **invoiceVat** (integer) - Invoice VAT rate. - **reverseCharge** (integer) - Reverse charge status. - **handlingFee** (integer) - Handling fee. - **description** (string) - Account description. - **industry** (integer) - Industry code. - **turnover** (integer) - Turnover amount. - **billingAddress** (string) - Billing address. - **billingCity** (string) - Billing city. - **billingPostalCode** (string) - Billing postal code. - **billingCountry** (integer) - Billing country code. - **shippingAddress** (string) - Shipping address. - **shippingCity** (string) - Shipping city. - **shippingPostalCode** (string) - Shipping postal code. - **shippingCountry** (integer) - Shipping country code. - **twitter** (string) - Twitter profile URL. - **facebook** (string) - Facebook profile URL. - **blog** (string) - Blog URL. #### Response Example ```json { "id": 4635, "name": "Test Account", "type": 100, "businessId": "123456", "vatId": "852645", "phone": "+358-46-334605", "email": "email@planmill.com", "invoiceEmail": "invoice_email@planmill.com", "website": "http://www.planmill.com", "owner": 4891, "passive": 0, "termsOfPayment": 0, "invoiceChannel": 22, "invoiceVat": 24, "reverseCharge": 10, "handlingFee": 10, "description": "test description
", "industry": 100000, "turnover": 100000, "billingAddress": "Hameentie 19", "billingCity": "Helsinki", "billingPostalCode": "00500", "billingCountry": 73, "shippingAddress": "Siltasaarenkatu 18", "shippingCity": "Helsinki", "shippingPostalCode": "13233", "shippingCountry": 73, "twitter": "http://www.twitter.com", "facebook": "http://www.facebook.com", "blog": "http://www.blog.com" } ``` ``` -------------------------------- ### Generate HTML Docs from RAML Source: https://github.com/planmill/api/blob/master/README.md This command-line instruction generates an HTML documentation file from a RAML file using the `raml2html` tool. Ensure you are in the `api_docs` subdirectory and have the necessary RAML and schema files. ```bash raml2html -i planmill1_5.raml -o index.html ``` -------------------------------- ### Get Current User Information - PlanMill API (Bash) Source: https://context7.com/planmill/api/llms.txt Retrieves details of the currently authenticated user. This `GET /me` endpoint is useful for verifying authentication status and obtaining basic user profile information. ```bash curl -X GET "https://online.planmill.com/{instance}/api/1.5/me" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json;charset=UTF-8" # Response: # { # "id": 3081, # "firstName": "Adam", # "lastName": "Tester", # "email": "adam.test@planmill.com", # "userName": "adam.test", # "title": "Software Engineer", # "department": "Software Development", # "team": 4150, # "role": 1, # "language": 2, # "languageCode": "en", # "timeZone": "Europe/Helsinki", # "hireDate": "2014-01-01T00:00:00.000+0200", # "passive": 0, # "workPhone": "+358 10 322 9110", # "mobilePhone": "+358-466-5556951" # } ``` -------------------------------- ### Listening for Webhooks in Java Source: https://github.com/planmill/api/wiki/WebHooks This Java code snippet demonstrates how to listen for incoming webhook events from the Planmill API. It provides a reference to a GitHub repository containing a more detailed implementation. ```java https://github.com/planmill/api-data-helper/blob/master/src/main/java/com/planmill/api/datahelper/webhooks/WebHookListener.java ``` -------------------------------- ### POST /projects - Create Project Source: https://context7.com/planmill/api/llms.txt Creates a new project in PlanMill. The 'name' field is required. Returns the ID of the newly created project. ```APIDOC ## POST /projects - Create Project ### Description Creates a new project in PlanMill. The `name` field is required. Returns the ID of the newly created project. ### Method POST ### Endpoint `/projects` ### Parameters #### Request Body - **name** (string) - Required - The name of the new project. - **operationalId** (string) - Optional - The operational ID for the project. - **description** (string) - Optional - A description for the project. - **type** (integer) - Optional - The project type. - **category** (integer) - Optional - The project category. - **status** (integer) - Optional - The project status. - **account** (integer) - Optional - The associated account ID. - **billableStatus** (integer) - Optional - The billable status. - **fixedRevenue** (number) - Optional - The fixed revenue for the project. - **budgetedPurchase** (number) - Optional - The budgeted purchase cost. - **budgetedExpense** (number) - Optional - The budgeted expense cost. ### Request Example ```json { "name": "New Development Project", "operationalId": "PROJ-2024-001", "description": "Project for client delivery
", "type": 1, "category": 30, "status": 1, "account": 4635, "billableStatus": 1, "fixedRevenue": 50000, "budgetedPurchase": 5000, "budgetedExpense": 2000 } ``` ### Response #### Success Response (201 Created) - **id** (integer) - The ID of the newly created project. #### Response Example ```json { "id": 584044 } ``` ``` -------------------------------- ### Vacation Management API Source: https://github.com/planmill/api/wiki/API-1.0-compared-to-API-1.5 Endpoints for managing vacation records, including getting, deleting, inserting, and updating. ```APIDOC ## GET /vacation ### Description Retrieves vacation information based on provided parameters. ### Method GET ### Endpoint /vacation ### Parameters #### Query Parameters - **Vacation.Id** (integer) - Optional - The ID of the vacation record. - **Person.Id** (integer) - Required - The ID of the person whose vacations are being queried. ### Response #### Success Response (200) - **VacationRecord** (object) - Details of the vacation record. #### Response Example ```json { "VacationRecord": { "Id": 123, "PersonId": 456, "StartDate": "2023-10-26", "EndDate": "2023-10-30" } } ``` ## DELETE /vacation/{Id} ### Description Deletes a specific vacation record. ### Method DELETE ### Endpoint /vacation/{Id} ### Parameters #### Path Parameters - **Id** (integer) - Required - The ID of the vacation record to delete. ### Response #### Success Response (200) - **message** (string) - Confirmation of deletion. #### Response Example ```json { "message": "Vacation record deleted successfully." } ``` ## POST /vacation/insert ### Description Inserts a new vacation record. ### Method POST ### Endpoint /vacation/insert ### Parameters #### Request Body - **Fields** (object) - Required - Contains the fields for the new vacation record (e.g., Person.Id, StartDate, EndDate). ### Request Example ```json { "Fields": { "Person.Id": 456, "StartDate": "2023-11-15", "EndDate": "2023-11-20" } } ``` ### Response #### Success Response (200) - **VacationId** (integer) - The ID of the newly created vacation record. #### Response Example ```json { "VacationId": 789 } ``` ## PUT /vacation/update/{Id} ### Description Updates an existing vacation record. ### Method PUT ### Endpoint /vacation/update/{Id} ### Parameters #### Path Parameters - **Id** (integer) - Required - The ID of the vacation record to update. #### Request Body - **Fields** (object) - Required - Contains the updated fields for the vacation record. ### Request Example ```json { "Fields": { "StartDate": "2023-11-16", "EndDate": "2023-11-21" } } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation of update. #### Response Example ```json { "message": "Vacation record updated successfully." } ``` ``` -------------------------------- ### PlanMill API Authentication using OAuth 2.0 (Bash) Source: https://context7.com/planmill/api/llms.txt Demonstrates the multi-step process for authenticating with the PlanMill API using OAuth 2.0. It covers obtaining client credentials, requesting authorization, exchanging the code for an access token, and finally using the access token to make authenticated API requests. ```bash # Step 1: Register your application at # https://online.planmill.com/{instance}/api/registrations.jsp # This provides you with client_id and client_secret # Step 2: Get authorization (browser redirect) # User is redirected to: curl -X GET "https://online.planmill.com/{instance}/api/oauth2/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=https://yourapp.com/callback&response_type=code&scope=openid" # Step 3: Exchange authorization code for access token curl -X POST "https://online.planmill.com/{instance}/api/oauth2/token" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "grant_type=authorization_code" \ -d "client_id=YOUR_CLIENT_ID" \ -d "client_secret=YOUR_CLIENT_SECRET" \ -d "code=AUTHORIZATION_CODE" \ -d "redirect_uri=https://yourapp.com/callback" # Response: # { # "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...", # "token_type": "Bearer", # "expires_in": 3600, # "refresh_token": "dGhpcyBpcyBhIHJlZnJlc2ggdG9rZW4...", # "id_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." # } # Step 4: Use the access token in API requests curl -X GET "https://online.planmill.com/{instance}/api/1.5/me" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json;charset=UTF-8" ``` -------------------------------- ### API Authentication Helper Source: https://github.com/planmill/api/wiki/Security This page serves as a helper tool to generate an authentication header for quick prototyping and testing of the Planmill API. It is accessible via a URL that requires authentication. ```APIDOC ## API Authentication Helper ### Description This endpoint provides a utility to generate an authentication header. This is useful for quickly setting up API clients like Postman or SoapUI for prototyping and testing. ### Method GET ### Endpoint `https://online.planmill.com/yourinstancename/api/keytest.jsp` ### Parameters #### Query Parameters This endpoint does not have standard query parameters, but it requires authentication to access. #### Request Body Not applicable. ### Request Example No request body is needed. Access the endpoint via a browser or API client after authenticating with your Planmill credentials. ### Response #### Success Response (200) Upon successful authentication, this page will display a generated authentication header that you can copy and paste into your API client. The exact format may vary but typically includes authentication tokens. #### Response Example ``` Authorization: Bearer YOUR_GENERATED_TOKEN ``` **Note:** Replace `yourinstancename` with your actual Planmill instance name and `YOUR_GENERATED_TOKEN` with the token provided by the page. ```