Skip to content

Latest commit

 

History

History
366 lines (261 loc) · 15.5 KB

File metadata and controls

366 lines (261 loc) · 15.5 KB

Proxy

Overview

Available Operations

get

Proxies a downstream GET request to a service and injects the necessary credentials into a request stored in Vault. This allows you to have an additional security layer and logging without needing to rely on Unify for normalization. Note: Vault will proxy all data to the downstream URL and method/verb in the headers.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Apideck\Unify;
use Apideck\Unify\Models\Operations;

$sdk = Unify\Apideck::builder()
    ->setConsumerId('test-consumer')
    ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$request = new Operations\ProxyGetProxyRequest(
    serviceId: 'close',
    unifiedApi: 'hris',
    downstreamUrl: 'https://api.close.com/api/v1/lead',
    downstreamAuthorization: 'Bearer <token>',
    timeout: 30000,
);

$response = $sdk->proxy->get(
    request: $request
);

if ($response->responseJson !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\ProxyGetProxyRequest ✔️ The request object to use for the request.

Response

?Operations\ProxyGetProxyResponse

Errors

Error Type Status Code Content Type
Errors\Unauthorized 401 application/json
Errors\APIException 4XX, 5XX */*

options

Proxies a downstream OPTION request to a service and injects the necessary credentials into a request stored in Vault. This allows you to have an additional security layer and logging without needing to rely on Unify for normalization. Note: Vault will proxy all data to the downstream URL and method/verb in the headers.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Apideck\Unify;
use Apideck\Unify\Models\Operations;

$sdk = Unify\Apideck::builder()
    ->setConsumerId('test-consumer')
    ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$request = new Operations\ProxyOptionsProxyRequest(
    serviceId: 'close',
    unifiedApi: 'hris',
    downstreamUrl: 'https://api.close.com/api/v1/lead',
    downstreamAuthorization: 'Bearer <token>',
    timeout: 30000,
);

$response = $sdk->proxy->options(
    request: $request
);

if ($response->responseJson !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\ProxyOptionsProxyRequest ✔️ The request object to use for the request.

Response

?Operations\ProxyOptionsProxyResponse

Errors

Error Type Status Code Content Type
Errors\Unauthorized 401 application/json
Errors\APIException 4XX, 5XX */*

post

Proxies a downstream POST request to a service and injects the necessary credentials into a request stored in Vault. This allows you to have an additional security layer and logging without needing to rely on Unify for normalization. Note: Vault will proxy all data to the downstream URL and method/verb in the headers.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Apideck\Unify;
use Apideck\Unify\Models\Operations;

$sdk = Unify\Apideck::builder()
    ->setConsumerId('test-consumer')
    ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$request = new Operations\ProxyPostProxyRequest(
    serviceId: 'close',
    unifiedApi: 'hris',
    downstreamUrl: 'https://api.close.com/api/v1/lead',
    downstreamAuthorization: 'Bearer <token>',
    timeout: 30000,
);

$response = $sdk->proxy->post(
    request: $request
);

if ($response->responseJson !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\ProxyPostProxyRequest ✔️ The request object to use for the request.

Response

?Operations\ProxyPostProxyResponse

Errors

Error Type Status Code Content Type
Errors\Unauthorized 401 application/json
Errors\APIException 4XX, 5XX */*

put

Proxies a downstream PUT request to a service and injects the necessary credentials into a request stored in Vault. This allows you to have an additional security layer and logging without needing to rely on Unify for normalization. Note: Vault will proxy all data to the downstream URL and method/verb in the headers.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Apideck\Unify;
use Apideck\Unify\Models\Operations;

$sdk = Unify\Apideck::builder()
    ->setConsumerId('test-consumer')
    ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$request = new Operations\ProxyPutProxyRequest(
    serviceId: 'close',
    unifiedApi: 'hris',
    downstreamUrl: 'https://api.close.com/api/v1/lead',
    downstreamAuthorization: 'Bearer <token>',
    timeout: 30000,
);

$response = $sdk->proxy->put(
    request: $request
);

if ($response->responseJson !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\ProxyPutProxyRequest ✔️ The request object to use for the request.

Response

?Operations\ProxyPutProxyResponse

Errors

Error Type Status Code Content Type
Errors\Unauthorized 401 application/json
Errors\APIException 4XX, 5XX */*

patch

Proxies a downstream PATCH request to a service and injects the necessary credentials into a request stored in Vault. This allows you to have an additional security layer and logging without needing to rely on Unify for normalization. Note: Vault will proxy all data to the downstream URL and method/verb in the headers.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Apideck\Unify;
use Apideck\Unify\Models\Operations;

$sdk = Unify\Apideck::builder()
    ->setConsumerId('test-consumer')
    ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$request = new Operations\ProxyPatchProxyRequest(
    serviceId: 'close',
    unifiedApi: 'hris',
    downstreamUrl: 'https://api.close.com/api/v1/lead',
    downstreamAuthorization: 'Bearer <token>',
    timeout: 30000,
);

$response = $sdk->proxy->patch(
    request: $request
);

if ($response->responseJson !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\ProxyPatchProxyRequest ✔️ The request object to use for the request.

Response

?Operations\ProxyPatchProxyResponse

Errors

Error Type Status Code Content Type
Errors\Unauthorized 401 application/json
Errors\APIException 4XX, 5XX */*

delete

Proxies a downstream DELETE request to a service and injects the necessary credentials into a request stored in Vault. This allows you to have an additional security layer and logging without needing to rely on Unify for normalization. Note: Vault will proxy all data to the downstream URL and method/verb in the headers.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Apideck\Unify;
use Apideck\Unify\Models\Operations;

$sdk = Unify\Apideck::builder()
    ->setConsumerId('test-consumer')
    ->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$request = new Operations\ProxyDeleteProxyRequest(
    serviceId: 'close',
    unifiedApi: 'hris',
    downstreamUrl: 'https://api.close.com/api/v1/lead',
    downstreamAuthorization: 'Bearer <token>',
    timeout: 30000,
);

$response = $sdk->proxy->delete(
    request: $request
);

if ($response->responseJson !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\ProxyDeleteProxyRequest ✔️ The request object to use for the request.

Response

?Operations\ProxyDeleteProxyResponse

Errors

Error Type Status Code Content Type
Errors\Unauthorized 401 application/json
Errors\APIException 4XX, 5XX */*