+7 (499) 638-64-11
Попробовать
Постановка и автоматизация процессов разработки ПО

Программные интерфейсы (API)

Пример использования SOAP API на PHP

Создание нового пользователя:

 <?php
 $security = new SoapClient(
     'https://demo.myalm.ru/api/securityservice?wsdl',
     array(
         'soap_version'=>SOAP_1_1,
         'cache_wsdl' => WSDL_CACHE_NONE,
         'trace'=>true
     )
 );
 $result = $security->login(
     array(
         'username' => '***',
         'userpass' => '***',
         'project' => '')
 );
 $token = $result->return;
 
 $data = new SoapClient(
     'https://demo.myalm.ru/api/dataservice?wsdl',
     array(
         'soap_version'=>SOAP_1_1,
         'cache_wsdl' => WSDL_CACHE_NONE,
         'trace'=>true
     )
 );
 
 $user = $data->__soapCall('user.RemoteAdd',
     array (
         'token' => $token->Key,
         'parms' => array (
              'Caption' => 'New user',
              'Password' => 'test',
              'AskChangePassword' => 'Y',
              'Language' => 1,
              'Email' => '',
              'Login' => '',
              'Description' => '',
              'Phone' => '',
              'Photo' => '',
              'PhotoExt' => '',
              'PhotoPath' => '',
              'NotificationTrackingType' => '',
              'NotificationEmailType' => '',
              'OrderNum' => '',
              'RecordCreated' => '',
              'RecordModified' => '',
              'Id' => '',
              'GroupId' => '',
              'ClassName' => '',
              'RecordVersion' => '',
              'Url' => ''
         )
     )
 );
 
 echo $user->Id;

 

Создание заявки и изменение ее статуса:

 <?php
  $security = new SoapClient(
      'https://demo.myalm.ru/api/securityservice?wsdl',
      array(
          'soap_version'=>SOAP_1_1,
          'cache_wsdl' => WSDL_CACHE_NONE,
          'trace'=>true
      )
  );
  $result = $security->login(
      array(
          'username' => '*****',
          'userpass' => '****',
          'project' => '****')
  );
  $token = $result->return;
  
  $data = new SoapClient(
      'https://demo.myalm.ru/api/dataservice?wsdl',
      array(
          'soap_version'=>SOAP_1_1,
          'cache_wsdl' => WSDL_CACHE_NONE,
          'trace'=>true
      )
  );
  
  $request = $data->__soapCall('request.RemoteAdd',
      array (
          'token' => $token->Key,
          'parms' => array (
              'Caption' => 'New request',
              'Description' => 'test',
              'Environment' => '',
              'Priority' => '',
              'Estimation' => '',
              'State' => 'submitted',
              'Type' => '',
              'Function' => '',
              'Author' => '',
              'Owner' => '',
              'Project' => '',
              'SubmittedVersion' => '',
              'ClosedInVersion' => '',
              'PlannedRelease' => '',
              'LifecycleDuration' => '',
              'StartDate' => '',
              'FinishDate' => '',
              'DeliveryDate' => '',
              'Fact' => '',
              'FactTasks' => '',
              'OrderNum' => '',
              'RecordCreated' => '',
              'RecordModified' => '',
              'RecordVersion' => '',
              'Attachment' => '',
              'Tags' => '',
              'Links' => '',
              'ProjectPage' => '',
              'Question' => '',
              'DueWeeks' => '',
              'Watchers' => '',
              'Id' => '',
              'ClassName' => '',
              'Url' => ''
          )
      )
  );
  
  echo $request->Id;
 
  $request->State = 'planned';
  $request = $data->__soapCall('request.RemoteStore',
      array (
          'token' => $token->Key,
 	 'id' =>  $request->Id,
          'parms' => $request
      )
  );

Далее:

REST API