0

XTRF API - Adding Receivables to a Project

burg 1 year ago in Home Portal / Classic Projects updated by Bartosz Budzyński 1 year ago 6

Is there any documentation that explains each property in the API Request aside from the Swagger API Docs for XTRF?

Below is the sample Request Body for adding receivables to a project, however, I need to know what kind of arguments to be passed to each of them as there is no explanation provided in the XTRF API Docs. 

Also, I need to know which are mandatory fields in these API endpoints.

Any help is highly appreciated. TIA.


Example:

1. id - is this the project ID or something else?

2. languageCombinationIdNumber - cannot find it somewhere in the XTRF Interface

3. type - where should this come from? 

4. calculationUnitId - where should this come from? (Not available in the dictionaries)

5. taskId - where should this come from? (Not available in the dictionaries)

{
  "id": 0,
  "jobTypeId": 0,
  "languageCombination": {
    "sourceLanguageId": 0,
    "targetLanguageId": 0
  },
  "languageCombinationIdNumber": "string",
  "rateOrigin": "PRICE_PROFILE",
  "currencyId": 0,
  "total": 0,
  "invoiceId": "string",
  "type": "SIMPLE",
  "calculationUnitId": 0,
  "ignoreMinimumCharge": true,
  "minimumCharge": 0,
  "description": "string",
  "rate": 0,
  "quantity": 0,
  "taskId": 0,
  "catLogFile": {
    "name": "string",
    "url": "string",
    "content": "string",
    "token": "string"
  }
}

+1

Great fun, isn't it!

I haven't been able to identify them all, but I have moved this model into my code and that works like a charm:


{
  "jobTypeId": 0,
  "languageCombination": {
    "sourceLanguageId": 0,
    "targetLanguageId": 0
  },
  "rateOrigin": "PRICE_PROFILE",
  "type": "SIMPLE",
  "calculationUnitId": 0,
  "ignoreMinimumCharge": true,
  "minimumCharge": 0,
  "description": "string",
  "rate": 0,
  "quantity": 0,
  "catLogFile": {
    "name": "string",
    "url": "string",
    "content": "string",
    "token": "string"
  }
}


So, to answer your questions:

1. id - is this the project ID or something else? 
I don't use or add this and it functions well

2. languageCombinationIdNumber - cannot find it somewhere in the XTRF Interface

Same here, I skip adding this one

3. type - where should this come from?

This is either SIMPLE or CAT, depends on whether you would like to add a simple receivable, or a cat receivable.

4. calculationUnitId - where should this come from? (Not available in the dictionaries)

This is the Calculation unit ID, can be found on XTRF > Settings > System Values: Advanced > Calculation Units
Every unit has their own ID, which can be found in the url [host]/xtrf/faces/calculationUnit/form.seam?action=display&id=1

5. taskId - where should this come from? (Not available in the dictionaries)

Skip it as well

Hi Dennis,

Appreciate the help. I still have few questions though as I still cannot invoke the API call successfully.

Endpoint:

https://...../home-api/projects/{projectID}/finance/receivables


Would you mind sharing your API Request? :)

Here's mine after following your instructions and just set it to a default value. 

Image 2454




Sure:

{
  "jobTypeId": 1,
  "languageCombination": {
    "sourceLanguageId": 59,
    "targetLanguageId": 73
  },
  "rateOrigin": "PRICE_PROFILE",
  "type": "SIMPLE",
  "calculationUnitId": 1,
  "ignoreMinimumCharge": true,
  "minimumCharge": 0,
  "description": "Some some",
  "rate": 0.02,
  "quantity": 12
}

Image 2456

Image 2457

Image 2458

Image 2455

Hi Dennis,

Appreciate the prompt response.

I followed your request body identically and I was getting this error.

Image 2466

Image 2465



However, after adding a task ID manually from an old project that was generated with task in it and used that ID the API call invoked and it worked. 

Now, the question is where do I get these task IDs after the Project (Classic) has been created programmatically (dynamically)?

Image 2462

Image 2460

Ohhh, you work on classic projects. I always assume everyone is on Smart Projects. We don't work with classic projects at all. 
Retrieving the task ID's is something I don't have to do, but you could execute a GET projects/{projectId}?embed=tasks and you will most probably retrieve all the tasks within a project. This is an educated guess though.

Maybe I can help here. :) 

There's an "embed" parameter for fetching Classic Projects that allows you to get Tasks for that Project:

Image 2472