XeroAPI / xero-php-oauth2

Xero PHP SDK for oAuth 2 generated from Xero API OpenAPI Spec 3.0
MIT License
90 stars 64 forks source link

TrackingCategory option failing to create #290

Closed oldusername91 closed 2 years ago

oldusername91 commented 2 years ago

SDK you're using

Describe the bug TrackingCategory option failing to create correctly.

Using PUT TrackingCategories results in a 200 response while ommitting TrackingOptionID attribute.

Querying the TrackingCategory after the above 200 response reveals no new options were created.


To Reproduce

I am using the following method to create a new option for my tracking category:

  1. AccountingAip::createTrackingOptions()

Expected behavior I expect a 200 response when calling PUT TrackingCategories which includes the created option and its TrackingOptionID attribute.

PUT Request

^ GuzzleHttp\Psr7\Request^ {#7699
  -method: "PUT"
  -requestTarget: null
  -uri: GuzzleHttp\Psr7\Uri^ {#7770
    -scheme: "https"
    -userInfo: ""
    -host: "api.xero.com"
    -port: null
    -path: "/api.xro/2.0/TrackingCategories/<my tracking category guid>/Options"
    -query: ""
    -fragment: ""
  }
  -headers: array:6 [
    "Host" => array:1 [
      0 => "api.xero.com"
    ]
    "User-Agent" => array:1 [
      0 => "[xero-php-oauth2 (2.14.1)]"
    ]
    "xero-tenant-id" => array:1 [
      0 => "<my tenant>"
    ]
    "Accept" => array:1 [
      0 => "application/json"
    ]
    "Content-Type" => array:1 [
      0 => "application/json"
    ]
    "Authorization" => array:1 [
      0 => "<My auth details>"
    ]
  ]
  -headerNames: array:6 [
    "user-agent" => "User-Agent"
    "xero-tenant-id" => "xero-tenant-id"
    "accept" => "Accept"
    "content-type" => "Content-Type"
    "authorization" => "Authorization"
    "host" => "Host"
  ]
  -protocol: "1.1"
  -body:   "{"Name":"1015766"}"
}

XERO Response

  "Id": "132d0f7e-9df6-465f-8371-88d3a112783e",\r\n
  "Status": "OK",\r\n
  "ProviderName": "<my provider>",\r\n
  "DateTimeUTC": "\/Date(1656627563006)\/",\r\n
  "Options": [\r\n
    {\r\n
      "Name": "1015766",\r\n
      "Status": "ACTIVE",\r\n
      "HasValidationErrors": false,\r\n
      "IsDeleted": false,\r\n
      "IsArchived": false,\r\n
      "IsActive": true,\r\n
      "ValidationErrors": []\r\n
    }\r\n
  ]\r\n
}

The tracking category I am attempting to create a new option in already has ~8000 options. The docs mention a limit of 100, however this is not correct as I've had no troubles until now creating new options beyond 100.

RettBehrens commented 2 years ago

There is no hard limit on the tracking options as such, however, ~8000 far exceeds our recommended usage. You may face timeout issues in the API and tracking options may or may not appear in Xero despite returning a code 200 in the API call.

Tracking is ideal for reporting on areas of a business by department, cost centre, or location. It's not generally suited to job or project management as it doesn't allow for start or end dates, or the closing off and completion of a job category.

For job or project management your customers may want to consider one of the following solutions:

Xero Projects is a simplified project management solution that focuses on job financials and costings. It’s suitable for small to midsize businesses, and allows users to track time and expenses, and to create deposit, lump sum, and itemised invoices. WorkflowMax is a full featured complete project management solution, suitable for midsize to large businesses who need further functionality than Projects will provide. This is an add-on to Xero. ​Xero also integrates with some specialist job tracking systems that may be better suited to your job or project management needs.

I've included links to our support articles and to our Xero App Store for more detail on these options.

Xero Central article: Set up tracking categories

WorkflowMax: What is WorkflowMax?

Xero website:

Xero App Store - Invoicing and jobs

Xero App Store - Job/Projects Management

Projects in Xero