PHP code example of ta-chain / tachain-sdk

1. Go to this page and download the library: Download ta-chain/tachain-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ta-chain / tachain-sdk example snippets





 Configure API key authorization: ApiKey
$config = TachainSdk\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = TachainSdk\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer');

// Configure API key authorization: Signature
$config = TachainSdk\Configuration::getDefaultConfiguration()->setApiKey('X-Signature', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = TachainSdk\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Signature', 'Bearer');

// Configure Bearer authorization: BearerToken
$config = TachainSdk\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

// Configure API key authorization: Timestamp
$config = TachainSdk\Configuration::getDefaultConfiguration()->setApiKey('X-Timestamp', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = TachainSdk\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Timestamp', 'Bearer');


$apiInstance = new TachainSdk\Api\ApiDeclarationApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$x_credential_type = 'x_credential_type_example'; // string | Use 'Token' with bearer authorization, or 'API Key' with signed API key headers. This header is mandatory in the deployed API.
$attachment_id = 'attachment_id_example'; // string | query 方式传入的单个附件申报 ID。
$form_data_id = 'form_data_id_example'; // string | query 方式传入的单个表单申报 ID。
$tactic_chain_api_service_controllers_api_integration_v1_api_declaration_delete_request = new \TachainSdk\Model\TacticChainApiServiceControllersApiIntegrationV1ApiDeclarationDeleteRequest(); // \TachainSdk\Model\TacticChainApiServiceControllersApiIntegrationV1ApiDeclarationDeleteRequest

try {
    $result = $apiInstance->deleteV1DeclarationDelete($x_credential_type, $attachment_id, $form_data_id, $tactic_chain_api_service_controllers_api_integration_v1_api_declaration_delete_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ApiDeclarationApi->deleteV1DeclarationDelete: ', $e->getMessage(), PHP_EOL;
}