Exportar Relatório de Estimativa de Custo

Generate Costs Estimation report to have an insight on how to plan the budget. This report allows you to calculate the approximate translation cost of currently untranslated strings in the project.

Pedido

Note: Either use the combination of project identifier and project key or combination of project identifier, username, and account key to pass to this endpoint.

POST https://api.crowdin.com/api/project/{project-identifier}/reports/costs-estimation/export?key={project-key}
POST https://api.crowdin.com/api/project/{project-identifier}/reports/costs-estimation/export?login={username}&account-key={account-key}

Parâmetros

Nome Valor Descrição
unit optional string Defines the report unit. Acceptable values are: 'strings', 'words' (by default), 'chars', 'chars_with_spaces'.
mode optional string Defines the report mode. Acceptable values are: 'simple' (by default), 'fuzzy'.
calculate_internal_fuzzy_matches optional bool Available for fuzzy mode only. It counts all the internal matches, to check how many strings can be added to TM and used if the strings are translated one by one as listed. Tem atenção, que os cálculos são aproximados, porque as frases podem ser traduzidas numa ordem diferente. Os valores aceitáveis são: 1 ou 0.
idioma obrigatório string The language for which the report should be generated. For this use Сrowdin language codes.
date_from optional data Strings added from. Use the following ISO 8601 date format: YYYY-MM-DD±hh:mm
date_to optional data Strings added to. Use the following ISO 8601 date format: YYYY-MM-DD±hh:mm
regular_rates optional array Defines the regular rates for the specified categories.
Possible categories for a report in the simple mode are: 'default', 'tm', and 'approval'.
Possible categories for a report in the fuzzy mode are: 'approval', 'translation', 'perfect', 'matched', and three customized ranges between 60% and 100% (for example: 99-90).
individual_rates optional array Defines individual rates for the specified languages in the specified categories. Each item must contain the language and the rate parameters. The possible rate categories are the same as for the 'regular_rates' parameter.
currency optional string Defines the currency for which the whole report is generated. Acceptable values are: '$' (by default), '€', '¥', '£', 'A$', 'C$', 'Fr', 'CN¥', 'kr', 'NZ$', 'MX$', 'S$', 'HK$', 'kr', '₩', '₺', '₽', '₹', 'R$', 'R'.
format optional string Defines the export file format. Acceptable values are 'csv' and 'xlsx' (by default).
json opcional string May contain no value. Defines that the response should be in a JSON format.
jsonp opcional string Nome da função de retorno de chamada. Defines that the response should be in a JSONP format.
Variáveis
project-identifier string Identificador do projeto.
project-key string Chave da API do projeto. Tanto a project-key ou a combinação de login e account-key são obrigatórias.
login string O teu nome de utilizador no Crowdin. Tanto a project-key ou a combinação de login e account-key são obrigatórias.
account-key string A tua chave API de conta. Tanto a project-key ou a combinação de login e account-key são obrigatórias.

Resposta

If the method is successful it responds with an XML structure, as it is shown below.
<?xml version="1.0" encoding="UTF-8"?>
<success>
  <hash>x1ff24323a2f6058382b31fbc237bcd74</hash>
</success>
Exemplo de resposta mal-sucedida:
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <code>3</code>
  <message>A chave API não é válida</message>
</error>

Exemplos

  curl \
    -F "unit=chars" \
    -F "mode=simple" \
    -F "format=csv" \
    -F "language=uk" \
    -F "date_from=2017-01-01" \
    -F "date_to=2017-01-03" \
    -F "regular_rates[default]=1.05" \
    -F "regular_rates[tm]=1.00" \
    -F "regular_rates[approval]=2.00" \
    https://api.crowdin.com/api/project/{project-identifier}/reports/costs-estimation/export?key={project-key}
  
  curl \
    -F "unit=words" \
    -F "mode=fuzzy" \
    -F "format=xlsx" \
    -F "language=uk" \
    -F "date_from=2017-06-05+0200" \
    -F "regular_rates[translation]=2.05" \
    -F "regular_rates[perfect]=1.00" \
    -F "regular_rates[matched]=1.00" \
    -F "regular_rates[99-95]=1.03" \
    -F "regular_rates[94-90]=1.05" \
    -F "regular_rates[89-80]=1.20" \
    -F "regular_rates[approval]=3.00" \
    https://api.crowdin.com/api/project/{project-identifier}/reports/costs-estimation/export?key={project-key}
  
<?php
$request_url = 'https://api.crowdin.com/api/project/{project-identifier}/reports/costs-estimation/export?mode=words&key={project-key}&language=uk';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);
curl_close($ch);

echo $result;

Este artigo foi útil?