xero-php-oauth2 Project SDK Docs

# Xero Projects API

## SDK Documentation

# Project

# createProject

Create one or more new projects

    /Projects

### Usage and SDK Samples

    <?php
    require_once(__DIR__ . '/vendor/autoload.php');

    // Configure OAuth2 access token for authorization: OAuth2
    $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );

    $apiInstance = new XeroAPI\XeroPHP\Api\ProjectApi(
        new GuzzleHttp\Client(),
        $config
    );
    $xeroTenantId = "xeroTenantId_example";

    try {
      $result = $apiInstance->createProject($xeroTenantId, $projectCreateOrUpdate);
    } catch (Exception $e) {
      echo 'Exception when calling ProjectApi->createProject: ', $e->getMessage(), PHP_EOL;
    }
    ?>

## Scopes

projects | Grant read-write access to projects

## Parameters

Header parameters

Name | Description
--- | ---
Xero-Tenant-Id* | String Xero identifier for Tenant Required

Body parameters

Name | Description
--- | ---
projectCreateOrUpdate * | ProjectCreateOrUpdate Create a new project with ProjectCreateOrUpdate object Required

# createTimeEntry

Creates a time entry for a specific project

Allows you to create a specific task

    /Projects/{projectId}/Time

### Usage and SDK Samples

    <?php
    require_once(__DIR__ . '/vendor/autoload.php');

    // Configure OAuth2 access token for authorization: OAuth2
    $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );

    $apiInstance = new XeroAPI\XeroPHP\Api\ProjectApi(
        new GuzzleHttp\Client(),
        $config
    );
    $xeroTenantId = "xeroTenantId_example";
    $projectId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

    try {
      $result = $apiInstance->createTimeEntry($xeroTenantId, $projectId, $timeEntryCreateOrUpdate);
    } catch (Exception $e) {
      echo 'Exception when calling ProjectApi->createTimeEntry: ', $e->getMessage(), PHP_EOL;
    }
    ?>

## Scopes

projects | Grant read-write access to projects

## Parameters

Path parameters

Name | Description
--- | ---
projectId* | UUID (uuid) You can specify an individual project by appending the projectId to the endpoint Required

Header parameters

Name | Description
--- | ---
Xero-Tenant-Id* | String Xero identifier for Tenant Required

Body parameters

Name | Description
--- | ---
timeEntryCreateOrUpdate * | TimeEntryCreateOrUpdate The time entry object you are creating Required

# deleteTimeEntry

Deletes a time entry for a specific project

Allows you to delete a specific time entry

    /Projects/{projectId}/Time/{timeEntryId}

### Usage and SDK Samples

    <?php
    require_once(__DIR__ . '/vendor/autoload.php');

    // Configure OAuth2 access token for authorization: OAuth2
    $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );

    $apiInstance = new XeroAPI\XeroPHP\Api\ProjectApi(
        new GuzzleHttp\Client(),
        $config
    );
    $xeroTenantId = "xeroTenantId_example";
    $projectId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
    $timeEntryId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

    try {
      $apiInstance->deleteTimeEntry($xeroTenantId, $projectId, $timeEntryId);
    } catch (Exception $e) {
      echo 'Exception when calling ProjectApi->deleteTimeEntry: ', $e->getMessage(), PHP_EOL;
    }
    ?>

## Scopes

projects | Grant read-write access to projects

## Parameters

Path parameters

Name | Description
--- | ---
projectId* | UUID (uuid) You can specify an individual project by appending the projectId to the endpoint Required
timeEntryId* | UUID (uuid) You can specify an individual task by appending the id to the endpoint Required

Header parameters

Name | Description
--- | ---
Xero-Tenant-Id* | String Xero identifier for Tenant Required

# getProject

Retrieves a single project

Allows you to retrieve a specific project using the projectId

    /Projects/{projectId}

### Usage and SDK Samples

    <?php
    require_once(__DIR__ . '/vendor/autoload.php');

    // Configure OAuth2 access token for authorization: OAuth2
    $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );

    $apiInstance = new XeroAPI\XeroPHP\Api\ProjectApi(
        new GuzzleHttp\Client(),
        $config
    );
    $xeroTenantId = "xeroTenantId_example";
    $projectId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

    try {
      $result = $apiInstance->getProject($xeroTenantId, $projectId);
    } catch (Exception $e) {
      echo 'Exception when calling ProjectApi->getProject: ', $e->getMessage(), PHP_EOL;
    }
    ?>

## Scopes

projects | Grant read-write access to projects
projects.read | Grant read-only access to projects

## Parameters

Path parameters

Name | Description
--- | ---
projectId* | UUID (uuid) You can specify an individual project by appending the projectId to the endpoint Required

Header parameters

Name | Description
--- | ---
Xero-Tenant-Id* | String Xero identifier for Tenant Required

# getProjectUsers

Retrieves a list of all project users

Allows you to retrieve the users on a projects.

    /ProjectsUsers

### Usage and SDK Samples

    <?php
    require_once(__DIR__ . '/vendor/autoload.php');

    // Configure OAuth2 access token for authorization: OAuth2
    $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );

    $apiInstance = new XeroAPI\XeroPHP\Api\ProjectApi(
        new GuzzleHttp\Client(),
        $config
    );
    $xeroTenantId = "xeroTenantId_example";
    $page = 1;
    $pageSize = 100;

    try {
      $result = $apiInstance->getProjectUsers($xeroTenantId, $page, $pageSize);
    } catch (Exception $e) {
      echo 'Exception when calling ProjectApi->getProjectUsers: ', $e->getMessage(), PHP_EOL;
    }
    ?>

## Scopes

projects | Grant read-write access to projects
projects.read | Grant read-only access to projects

## Parameters

Header parameters

Name | Description
--- | ---
Xero-Tenant-Id* | String Xero identifier for Tenant Required

Query parameters

Name | Description
--- | ---
page | Integer set to 1 by default. The requested number of the page in paged response - Must be a number greater than 0.
pageSize | Integer Optional, it is set to 50 by default. The number of items to return per page in a paged response - Must be a number between 1 and 500.

# getProjects

Retrieves all projects

Allows you to retrieve, create and update projects.

    /Projects

### Usage and SDK Samples

    <?php
    require_once(__DIR__ . '/vendor/autoload.php');

    // Configure OAuth2 access token for authorization: OAuth2
    $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );

    $apiInstance = new XeroAPI\XeroPHP\Api\ProjectApi(
        new GuzzleHttp\Client(),
        $config
    );
    $xeroTenantId = "xeroTenantId_example";
    $projectIds = array()
    $contactID = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
    $states = "states_example";
    $page = 1;
    $pageSize = 100;

    try {
      $result = $apiInstance->getProjects($xeroTenantId, $projectIds, $contactID, $states, $page, $pageSize);
    } catch (Exception $e) {
      echo 'Exception when calling ProjectApi->getProjects: ', $e->getMessage(), PHP_EOL;
    }
    ?>

## Scopes

projects | Grant read-write access to projects
projects.read | Grant read-only access to projects

## Parameters

Header parameters

Name | Description
--- | ---
Xero-Tenant-Id* | String Xero identifier for Tenant Required

Query parameters

Name | Description
--- | ---
projectIds | array[UUID] (uuid) Search for all projects that match a comma separated list of projectIds
contactID | UUID (uuid) Filter for projects for a specific contact
states | String Filter for projects in a particular state (INPROGRESS or CLOSED)
page | Integer set to 1 by default. The requested number of the page in paged response - Must be a number greater than 0.
pageSize | Integer Optional, it is set to 50 by default. The number of items to return per page in a paged response - Must be a number between 1 and 500.

# getTask

Retrieves a single project task

Allows you to retrieve a specific project

    /Projects/{projectId}/Tasks/{taskId}

### Usage and SDK Samples

    <?php
    require_once(__DIR__ . '/vendor/autoload.php');

    // Configure OAuth2 access token for authorization: OAuth2
    $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );

    $apiInstance = new XeroAPI\XeroPHP\Api\ProjectApi(
        new GuzzleHttp\Client(),
        $config
    );
    $xeroTenantId = "xeroTenantId_example";
    $projectId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
    $taskId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

    try {
      $result = $apiInstance->getTask($xeroTenantId, $projectId, $taskId);
    } catch (Exception $e) {
      echo 'Exception when calling ProjectApi->getTask: ', $e->getMessage(), PHP_EOL;
    }
    ?>

## Scopes

projects | Grant read-write access to projects
projects.read | Grant read-only access to projects

## Parameters

Path parameters

Name | Description
--- | ---
projectId* | UUID (uuid) You can specify an individual project by appending the projectId to the endpoint Required
taskId* | UUID (uuid) You can specify an individual task by appending the taskId to the endpoint, i.e. GET https://.../tasks/{taskID} Required

Header parameters

Name | Description
--- | ---
Xero-Tenant-Id* | String Xero identifier for Tenant Required

# getTasks

Retrieves all project tasks

Allows you to retrieve a specific project

    /Projects/{projectId}/Tasks

### Usage and SDK Samples

    <?php
    require_once(__DIR__ . '/vendor/autoload.php');

    // Configure OAuth2 access token for authorization: OAuth2
    $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );

    $apiInstance = new XeroAPI\XeroPHP\Api\ProjectApi(
        new GuzzleHttp\Client(),
        $config
    );
    $xeroTenantId = "xeroTenantId_example";
    $projectId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
    $page = 1;
    $pageSize = 10;
    $taskIds = "taskIds_example";
    $chargeType = ;

    try {
      $result = $apiInstance->getTasks($xeroTenantId, $projectId, $page, $pageSize, $taskIds, $chargeType);
    } catch (Exception $e) {
      echo 'Exception when calling ProjectApi->getTasks: ', $e->getMessage(), PHP_EOL;
    }
    ?>

## Scopes

projects | Grant read-write access to projects
projects.read | Grant read-only access to projects

## Parameters

Path parameters

Name | Description
--- | ---
projectId* | UUID (uuid) You can specify an individual project by appending the projectId to the endpoint Required

Header parameters

Name | Description
--- | ---
Xero-Tenant-Id* | String Xero identifier for Tenant Required

Query parameters

Name | Description
--- | ---
page | Integer Set to 1 by default. The requested number of the page in paged response - Must be a number greater than 0.
pageSize | Integer Optional, it is set to 50 by default. The number of items to return per page in a paged response - Must be a number between 1 and 500.
taskIds | String taskIdsSearch for all tasks that match a comma separated list of taskIds, i.e. GET https://.../tasks?taskIds={taskID},{taskID}
chargeType | ChargeType

# getTimeEntries

Retrieves all time entries associated with a specific project

Allows you to retrieve the time entries associated with a specific project

    /Projects/{projectId}/Time

### Usage and SDK Samples

    <?php
    require_once(__DIR__ . '/vendor/autoload.php');

    // Configure OAuth2 access token for authorization: OAuth2
    $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );

    $apiInstance = new XeroAPI\XeroPHP\Api\ProjectApi(
        new GuzzleHttp\Client(),
        $config
    );
    $xeroTenantId = "xeroTenantId_example";
    $projectId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
    $userId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
    $taskId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
    $invoiceId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
    $contactId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
    $page = 1;
    $pageSize = 10;
    $states = array()
    $isChargeable = true;
    $dateAfterUtc = new DateTime("2013-10-20T19:20:30+01:00");
    $dateBeforeUtc = new DateTime("2013-10-20T19:20:30+01:00");

    try {
      $result = $apiInstance->getTimeEntries($xeroTenantId, $projectId, $userId, $taskId, $invoiceId, $contactId, $page, $pageSize, $states, $isChargeable, $dateAfterUtc, $dateBeforeUtc);
    } catch (Exception $e) {
      echo 'Exception when calling ProjectApi->getTimeEntries: ', $e->getMessage(), PHP_EOL;
    }
    ?>

## Scopes

projects | Grant read-write access to projects
projects.read | Grant read-only access to projects

## Parameters

Path parameters

Name | Description
--- | ---
projectId* | UUID (uuid) Identifier of the project, that the task (which the time entry is logged against) belongs to. Required

Header parameters

Name | Description
--- | ---
Xero-Tenant-Id* | String Xero identifier for Tenant Required

Query parameters

Name | Description
--- | ---
userId | UUID (uuid) The xero user identifier of the person who logged time.
taskId | UUID (uuid) Identifier of the task that time entry is logged against.
invoiceId | UUID (uuid) Finds all time entries for this invoice.
contactId | UUID (uuid) Finds all time entries for this contact identifier.
page | Integer Set to 1 by default. The requested number of the page in paged response - Must be a number greater than 0.
pageSize | Integer Optional, it is set to 50 by default. The number of items to return per page in a paged response - Must be a number between 1 and 500.
states | array[String] Comma-separated list of states to find. Will find all time entries that are in the status of whatever is specified.
isChargeable | Boolean Finds all time entries which relate to tasks with the charge type `TIME` or `FIXED`.
dateAfterUtc | Date (date-time) ISO 8601 UTC date. Finds all time entries on or after this date filtered on the `dateUtc` field.
dateBeforeUtc | Date (date-time) ISO 8601 UTC date. Finds all time entries on or before this date filtered on the `dateUtc` field.

# getTimeEntry

Retrieves a single time entry for a specific project

Allows you to get a single time entry in a project

    /Projects/{projectId}/Time/{timeEntryId}

### Usage and SDK Samples

    <?php
    require_once(__DIR__ . '/vendor/autoload.php');

    // Configure OAuth2 access token for authorization: OAuth2
    $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );

    $apiInstance = new XeroAPI\XeroPHP\Api\ProjectApi(
        new GuzzleHttp\Client(),
        $config
    );
    $xeroTenantId = "xeroTenantId_example";
    $projectId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
    $timeEntryId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

    try {
      $result = $apiInstance->getTimeEntry($xeroTenantId, $projectId, $timeEntryId);
    } catch (Exception $e) {
      echo 'Exception when calling ProjectApi->getTimeEntry: ', $e->getMessage(), PHP_EOL;
    }
    ?>

## Scopes

projects | Grant read-write access to projects
projects.read | Grant read-only access to projects

## Parameters

Path parameters

Name | Description
--- | ---
projectId* | UUID (uuid) You can specify an individual project by appending the projectId to the endpoint Required
timeEntryId* | UUID (uuid) You can specify an individual time entry by appending the id to the endpoint Required

Header parameters

Name | Description
--- | ---
Xero-Tenant-Id* | String Xero identifier for Tenant Required

# patchProject

creates a project for the specified contact

Allows you to update a specific projects.

    /Projects/{projectId}

### Usage and SDK Samples

    <?php
    require_once(__DIR__ . '/vendor/autoload.php');

    // Configure OAuth2 access token for authorization: OAuth2
    $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );

    $apiInstance = new XeroAPI\XeroPHP\Api\ProjectApi(
        new GuzzleHttp\Client(),
        $config
    );
    $xeroTenantId = "xeroTenantId_example";
    $projectId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

    try {
      $apiInstance->patchProject($xeroTenantId, $projectId, $projectPatch);
    } catch (Exception $e) {
      echo 'Exception when calling ProjectApi->patchProject: ', $e->getMessage(), PHP_EOL;
    }
    ?>

## Scopes

projects | Grant read-write access to projects

## Parameters

Path parameters

Name | Description
--- | ---
projectId* | UUID (uuid) You can specify an individual project by appending the projectId to the endpoint Required

Header parameters

Name | Description
--- | ---
Xero-Tenant-Id* | String Xero identifier for Tenant Required

Body parameters

Name | Description
--- | ---
projectPatch * | ProjectPatch Update the status of an existing Project Required

# updateProject

Updates a specific project

Allows you to update a specific projects.

    /Projects/{projectId}

### Usage and SDK Samples

    <?php
    require_once(__DIR__ . '/vendor/autoload.php');

    // Configure OAuth2 access token for authorization: OAuth2
    $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );

    $apiInstance = new XeroAPI\XeroPHP\Api\ProjectApi(
        new GuzzleHttp\Client(),
        $config
    );
    $xeroTenantId = "xeroTenantId_example";
    $projectId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

    try {
      $apiInstance->updateProject($xeroTenantId, $projectId, $projectCreateOrUpdate);
    } catch (Exception $e) {
      echo 'Exception when calling ProjectApi->updateProject: ', $e->getMessage(), PHP_EOL;
    }
    ?>

## Scopes

projects | Grant read-write access to projects

## Parameters

Path parameters

Name | Description
--- | ---
projectId* | UUID (uuid) You can specify an individual project by appending the projectId to the endpoint Required

Header parameters

Name | Description
--- | ---
Xero-Tenant-Id* | String Xero identifier for Tenant Required

Body parameters

Name | Description
--- | ---
projectCreateOrUpdate * | ProjectCreateOrUpdate Request of type ProjectCreateOrUpdate Required

# updateTimeEntry

Updates a time entry for a specific project

Allows you to update time entry in a project

    /Projects/{projectId}/Time/{timeEntryId}

### Usage and SDK Samples

    <?php
    require_once(__DIR__ . '/vendor/autoload.php');

    // Configure OAuth2 access token for authorization: OAuth2
    $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );

    $apiInstance = new XeroAPI\XeroPHP\Api\ProjectApi(
        new GuzzleHttp\Client(),
        $config
    );
    $xeroTenantId = "xeroTenantId_example";
    $projectId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
    $timeEntryId = "38400000-8cf0-11bd-b23e-10b96e4ef00d";

    try {
      $apiInstance->updateTimeEntry($xeroTenantId, $projectId, $timeEntryId, $timeEntryCreateOrUpdate);
    } catch (Exception $e) {
      echo 'Exception when calling ProjectApi->updateTimeEntry: ', $e->getMessage(), PHP_EOL;
    }
    ?>

## Scopes

projects | Grant read-write access to projects

## Parameters

Path parameters

Name | Description
--- | ---
projectId* | UUID (uuid) You can specify an individual project by appending the projectId to the endpoint Required
timeEntryId* | UUID (uuid) You can specify an individual time entry by appending the id to the endpoint Required

Header parameters

Name | Description
--- | ---
Xero-Tenant-Id* | String Xero identifier for Tenant Required

Body parameters

Name | Description
--- | ---
timeEntryCreateOrUpdate * | TimeEntryCreateOrUpdate The time entry object you are updating Required