]project-open[ : @This Wiki
Portrait

Welcome, Unregistered Visitor

Contact ·  Index · Login · Register
 

Contents

Remote Training
Support
SaaS Service

7 registered users
 in last 24 hours

]po[ REST Interface - Creating Objects

This page provides details on creating new objects via the ]po[ REST interface.

Object Creation Overview

While U=Update operation is a "generic" operations allowing any of the object's field to be updated, the C=Creation requires a certain structure of attributes for a successful object creation. The following section details the minimum attributes required for object creation.

Project

In order to create a new project, you need to provide the attributes:

  • project_name,
  • project_nr
  • project_path (=project_nr)
  • company_id (the customer)
  • project_status_id and
  • project_type_id

All other attributes are technically optional during the C=Create operation, even though these fields may be necessary for normal operations (for example: A project with an empty start_date or end_date may not appear in the ProjectListPage.

Please find below an esample XML structure for creating a new project.

<im_project>­
        <project_name>EPM Tool</project_name>
        <project_nr>2005_0002</project_nr>
        <project_path>2005_0002</project_path>
        <company_id>8779</company_id>
        <project_status_id>76</project_status_id>
        <project_type_id>99</project_type_id>
        <start_date>2007-08-12</start_date>
        <end_date>2008-04-04</end_date>
</im_project>
­

Assuming that this XML structure is stored in a file name "im_project.xml", you can create a new project using the following "wget" statement:

wget -O - --post-file=im_project.xml --user='bbigboss@tigerpond.com' --password=ben http://localhost/intranet-rest/im_project

As a result, the REST interface should return a XML structure with the object_id of the newly created object:

<?xml version='1.0'?>
<object_id>123456</object_id>

Translation Task

The creation of translation tasks works analog to the creation of projects. The XML structure looks like this:

<?xml version='1.0'?>
<im_trans_task>
        <task_name>REST-Task.doc</task_name>
        <task_filename>RESt-Task.doc</task_filename>
        <project_id>202906</project_id>
        <task_uom_id href="http://localhost/intranet-rest/im_category/324">324</task_uom_id>
        <task_status_id href="http://localhost/intranet-rest/im_category/340">340</task_status_id>
        <task_type_id href="http://localhost/intranet-rest/im_category/89">89</task_type_id>
        <task_units>417.2</task_units>
        <billable_units>417.2</billable_units>
        <end_date>2006-04-23 00:00:00+02</end_date>
        <source_language_id href="http://localhost/intranet-rest/im_category/261">261</source_language_id>
        <target_language_id href="http://localhost/intranet-rest/im_category/251">251</target_language_id>

        <match0>402</match0>
        <match100>0</match100>
        <match50>0</match50>
        <match75>6</match75>
        <match85>6</match85>
        <match95>4</match95>
        <match_rep>20</match_rep>
        <match_x>0</match_x>

        <trans_id>624</trans_id>
        <edit_id>8864</edit_id>
        <proof_id>624</proof_id>
        <other_id></other_id>
</im_trans_task>
­

Financial Documents (im_invoice and im_invoice_item)

The creation of financial documents consists of two parts: Creating the financial document itself (im_invoice) and then populating the document with a number of items (im_invoice_item).

Creating the im_invoice document will result in a financial document with amount=0:

<?xml version='1.0'?>
<im_invoice>
        <invoice_nr>I2010_03_0002</invoice_nr>
        <customer_id href="http://localhost/intranet-rest/im_company/9672">9672</customer_id>
        <company_contact_id href="http://localhost/intranet-rest/user/"></company_contact_id>
        <provider_id href="http://localhost/intranet-rest/im_company/8720">8720</provider_id>
        <invoice_office_id href="http://localhost/intranet-rest/im_office/"></invoice_office_id>
        <cost_status_id href="http://localhost/intranet-rest/im_category/3810">3810</cost_status_id>
        <cost_type_id href="http://localhost/intranet-rest/im_category/3700">3700</cost_type_id>
        <effective_date>2010-03-01</effective_date>
        <payment_days>30</payment_days>
        <payment_method_id href="http://localhost/intranet-rest/im_category/804">804</payment_method_id>
        <template_id href="http://localhost/intranet-rest/im_category/900">900</template_id>
</im_invoice>
­

In a second step you may now add items to the financial document using:

<?xml version='1.0'?>
<im_invoice_item>
        <item_name>Line 01</item_name>
        <invoice_id>203172</invoice_id>
        <item_units>123.0</item_units>
        <item_uom_id>321</item_uom_id>
        <price_per_unit>50.000</price_per_unit>
        <currency>EUR</currency>
        <sort_order>10</sort_order>
</im_invoice_item>
­

An object type specific logic will update the financial document amount with the sum of the items.

Please note that all items should have the same currency. Otherwise the amount of the financial document is undefined.

 

 

 

 

 



Please take a moment to complete this form to help us improve our service.

Note:
Please only provide feedback in regards to content this page shows. For support inquiries please refer either to the Community Support forum at Sourceforge or check out our 'Professional Support'

Did this page help you to achieve your goal?

 Yes  No  Don't know

Please provide us with comments to improve this page:

How useful is the information?

 1  2  3  4  5
Not
useful
      Extremely
useful
 
  

Explore

Installers
Demo Server
Modules & Functionality
Packages
Business Processes supported
FAQ's

Help

Getting started
User Manuals
Configuration Manuals
Community Support
Professional Support

News

News
Twitter
RSS Community / Sourceforge
Register for Newsletter

Get in touch

Contact
Register



Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0 Generic License - Privacy Policy