REST API Invoices

Listing invoices

GET /invoices.xml

Returns a paginated list of invoices.

Parameters:

Parameter Type Description
project_id integer/string get invoices from the project with the given id
status_id integer get invoices by status with the given id
search string get invoices with the given search string

Examples:

GET /invoices.xml 
GET /invoices.xml?project_id=2 
GET /invoices.xml?search=crm 

Paging example: 
GET /invoices.xml?project_id=testproject&page=1
GET /invoices.xml?project_id=testproject&page=2

Response:

<invoices total_count="6" type="array">
  <invoice>
    <id>1</id>
    <number>INV/20111201-01</number>
    <invoice_date>2011-11-30</invoice_date>
    <language>en</language>
    <currency>USD</currency>
    <amount>6569.88</amount>
    <balance>0.0</balance>
    <project id="11" name="Redmine Invoices plugin demo"/>
    <status id="0" name="Estimate"/>
    <contact id="11" name="Apple Inc."/>
    <author id="4" name="Smith Paul"/>
    <assigned_to id="4" name="Smith Paul"/>
    <created_on>2011-12-01T16:48:32Z</created_on>
    <updated_on>2014-02-18T07:54:05Z</updated_on>
    <custom_fields type="array">
      <custom_field id="4" name="Text custom field">
        <value>Test text</value>
      </custom_field>
      <custom_field id="5" name="Date custom field">
        <value>2011-12-15</value>
      </custom_field>
    </custom_fields>
  </invoice>
  ...
</invoices>

Showing an invoice

GET /invoices/[id].xml

Examples:

GET /invoices/2.xml
GET /invoices/2.json

Response:

<invoice>
  <id>82</id>
  <number>INV/20131125-01</number>
  <invoice_date>2013-11-25</invoice_date>
  <due_date>2013-11-29</due_date>
  <language/>
  <currency>USD</currency>
  <discount>10.0</discount>
  <discount_type>0</discount_type>
  <amount>581.4</amount>
  <balance>0.0</balance>
  <description>
    This is invoice +description+ with *_textile_* *syntax*: * Item 1 * Item 2
  </description>
  <project id="4" name="Redmine CRM plugin demo"/>
  <status id="2" name="Выставлен"/>
  <contact id="11" name="Apple Inc."/>
  <author id="4" name="Smith Paul"/>
  <assigned_to id="4" name="Smith Paul"/>
  <created_on>2013-11-25T12:17:23Z</created_on>
  <updated_on>2013-11-25T12:17:23Z</updated_on>
  <custom_fields type="array">
    <custom_field id="4" name="Text custom field">
      <value>Custom field</value>
    </custom_field>
    <custom_field id="5" name="Date custom field">
      <value>2013-11-22</value>
    </custom_field>
  </custom_fields>
  <lines type="array">
    <invoice_line>
      <id>165</id>
      <position>1</position>
      <quantity>6.5</quantity>
      <description>Public access for support tickets</description>
      <tax/>
      <tax_amount>0.0</tax_amount>
      <price>20.0</price>
      <units/>
      <total>130.0</total>
    </invoice_line>
    ...
  </lines>
</invoice>

Creating an invoice

POST /invoices.[format]

Parameters:

  • invoice - A hash of the invoice attributes:
    • number
    • invoice_date
    • due_date
    • language
    • currency
    • discount
    • discount_type
    • amount
    • balance
    • description
    • project_id
    • status_id
    • contact_id
    • author_id
    • assigned_to_id
    • created_on
    • updated_on
    • lines_attributes
      • 0
        • position
        • quantity
        • description
        • product_id
        • tax
        • price
        • units
      • 1
        • position
        • quantity
        • description
        • product_id
        • tax
        • price
        • units
Was this article helpful? Yes  No
480 from 532 found this helpful