Skip to content

How to Create a Project using XTRF APIs with PHP

Last updated on February 10, 2018

In this post, I would like to write about creating projects on XTRF using web services and PHP.

XTRF is one of the most popular and fastest growing management systems for translation agencies and corporate translation departments.

In order to create projects, we need to authenticate to XTRF first. In my previous post I wrote a tutorial on authenticating to XTRF please read it if you are not familiar with authenticating.

XTRF will accept only specific parameters, which we have to send. Below are the parameters which we have to send to XTRF to create a project and task you can change values as you wish and I am going to create a project using data.

 $projectData = [
      'customerName' => 'Test Client',
       'name' => 'Test Project',
       'workflowName' => 'TEST',
       'customerPriceProfileName' => 'American Dollar [$]',
       'currencyName' => 'American Dollar [$]',
       'tasks' => [
           ['sourceLanguageCode' => "en-us",
               'targetLanguageCode' => "LT",
               'languageSpecializationName' => 'General',
               'deadline' => date('Y-m-d H: i'),
               'startDate' => date('Y-m-d H:i'),
               'files' => [
                 /*  [
                       'name' => 'source file -01',
                       'category' => 'Workfile',
                       'url' => ''
                   ],
                   [
                       'name' => 'ref file 01',
                       'category' => 'Reference',
                       'url' => ''
                   ] */
               ] 
               'customerTaskNumber' => '',
               'name' => 'test'
           ]
       ],
       'dateOfEvent' => date('Y-m-d H:i'),
       'customerSpecialInstructions' => 'test instructions',
       'deadline' => date('Y-m-d H:i'),
       'startDate' => date('Y-m-d H:i'),
       'additionalPersonsId' => [1],
       'personId' => 1, 
       'sendBackToPersonId' => 1,
   ];

$wsdlUrl = 'http://...../translationManagementService/XTRFService?wsdl';
$username = '';
$password = '';

 
$opts = ['ssl'   => ['verify_peer' => false,'verify_peer_name' => false,'ciphers'=>'RC4-SHA'] ];
 
$client = new SoapClient($wsdlUrl,['stream_context' => stream_context_create($opts)]);

if($client->login(['userName' => $username, 'password' => $password])) {
   print_r($client->createProject(['project' => $projectData]));
}

upon successful creation, it will return JSON object with some information about the project and on failure, it will return false.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments