Skip to content

Latest commit

 

History

History
83 lines (62 loc) · 7.01 KB

File metadata and controls

83 lines (62 loc) · 7.01 KB

Proxy

Overview

Routing API requests through StackOne directly to the underlying provider.

Available Operations

proxyRequest

Proxy Request

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use StackOne\client;
use StackOne\client\Models\Components;

$sdk = client\StackOne::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$proxyRequestBody = new Components\ProxyRequestBody(
    url: 'https://api.sample-integration.com/v1',
    path: '/employees/directory',
    headers: [
        'Content-Type' => 'application/json',
    ],
);

$response = $sdk->proxy->proxyRequest(
    xAccountId: '<id>',
    proxyRequestBody: $proxyRequestBody,
    prefer: 'heartbeat'

);

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

Parameters

Parameter Type Required Description Example
xAccountId string ✔️ The account identifier
proxyRequestBody Components\ProxyRequestBody ✔️ The request body
prefer ?string Set to "heartbeat" to enable keep-alive newline heartbeats during long-running requests. Response includes Preference-Applied: heartbeat header when honored. (RFC 7240) heartbeat

Response

?Operations\StackoneProxyRequestResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestResponse 400 application/json
Errors\UnauthorizedResponse 401 application/json
Errors\ForbiddenResponse 403 application/json
Errors\NotFoundResponse 404 application/json
Errors\RequestTimedOutResponse 408 application/json
Errors\ConflictResponse 409 application/json
Errors\PreconditionFailedResponse 412 application/json
Errors\UnprocessableEntityResponse 422 application/json
Errors\TooManyRequestsResponse 429 application/json
Errors\InternalServerErrorResponse 500 application/json
Errors\NotImplementedResponse 501 application/json
Errors\BadGatewayResponse 502 application/json
Errors\SDKException 4XX, 5XX */*