OpenAPI
How to generate API
You can use OpenAPI Generator to generate a client library
For example
openapi-generator-cli generate -i https://HELP_NAME/api/openapi -g java -o outThen you can use the generated library.
Here is the example for fetching an order status.
// openapi-generator-cli generate -i https://HELP_NAME/api/openapi -g java -o out
import org.openapitools.client.ApiClient;import org.openapitools.client.ApiException;import org.openapitools.client.model.StatusRequest;import org.openapitools.client.model.StatusResponse;
public class GetStatusExample { public static void main(String[] args) throws ApiException { Integer requestorId = 10; String basePath = "https://{SERVER_BASE_PATH}"; String bearerToken = "bt_q1***13"; long orderSystemId = 54321;
ApiClient apiClient = new ApiClient(); apiClient.setBasePath(basePath); apiClient.setBearerToken(bearerToken);
PaymentsApi api = new PaymentsApi(apiClient);
StatusRequest statusRequest = new StatusRequest(); statusRequest.setOrderSystemId(orderSystemId);
StatusResponse statusResponse = api.paymentsStatusRequestorIdPost(requestorId, statusRequest);
System.out.println("statusResponse = " + statusResponse); }}// openapi-generator-cli generate -i https://HELP_NAME/api/openapi -g php -o out
$token = 'bt_q1***13';$requestor_id = 10; // int | Requestor ID$order_id = 54321;
$stack = new GuzzleHttp\HandlerStack();$stack->setHandler(new GuzzleHttp\Handler\CurlHandler());$options = ['handler' => $stack];$client = new GuzzleHttp\Client($options);
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken($token);
$apiInstance = new OpenAPI\Client\Api\PaymentsApi( $client, $config);
$status_request = new OpenAPI\Client\Model\StatusRequest();$status_request->setOrderSystemId($order_id);
try { $result = $apiInstance->paymentsStatusRequestorIdPost($requestor_id, $status_request); print_r($result);} catch (Exception $e) { echo 'Exception when calling PaymentsApi->paymentsStatusRequestorIdPost: ', $e->getCode(), $e->getMessage(), PHP_EOL;}// openapi-generator-cli generate -i https://HELP_NAME/api/openapi -g go -o outpackage main
import ( "fmt" "strings" "net/http" "io/ioutil")
func main() {
url := "{{SERVER_BASE_URL}}/payments/status/10"
payload := strings.NewReader("{ \"orderSystemId\": 54321 }")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", "Bearer bt_q1***13")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}