Perl Dwolla: Get Root Links

Back to Index

Fetches the root links for the Dwolla REST API.

Documentation: https://docsv2.dwolla.com/#root

CURL Command

curl https://api-sandbox.dwolla.com/ \
-H "Accept: application/vnd.dwolla.v1.hal+json" \
-H "Authorization: Bearer DWOLLA_ACCESS_TOKEN"

Perl Example

use chilkat();

$rest = chilkat::CkRest->new();

#  URL: https://api-sandbox.dwolla.com/
$bTls = 1;
$port = 443;
$bAutoReconnect = 1;
$success = $rest->Connect("api-sandbox.dwolla.com",$port,$bTls,$bAutoReconnect);
if ($success != 1) {
    print "ConnectFailReason: " . $rest->get_ConnectFailReason() . "\r\n";
    print $rest->lastErrorText() . "\r\n";
    exit;
}

$rest->AddHeader("Authorization","Bearer DWOLLA_ACCESS_TOKEN");
$rest->AddHeader("Accept","application/vnd.dwolla.v1.hal+json");

$sbResponseBody = chilkat::CkStringBuilder->new();
$success = $rest->FullRequestNoBodySb("GET","/",$sbResponseBody);
if ($success != 1) {
    print $rest->lastErrorText() . "\r\n";
    exit;
}

$jsonResponse = chilkat::CkJsonObject->new();
$jsonResponse->LoadSb($sbResponseBody);

$v_linksAccountHref = $jsonResponse->stringOf("_links.account.href");
$v_linksAccountType = $jsonResponse->stringOf("_links.account.type");
$v_linksAccountResource_type = $jsonResponse->stringOf("_links.account.resource-type");
$v_linksEventsHref = $jsonResponse->stringOf("_links.events.href");
$v_linksEventsType = $jsonResponse->stringOf("_links.events.type");
$v_linksEventsResource_type = $jsonResponse->stringOf("_links.events.resource-type");
$v_linksWebhook_subscriptionsHref = $jsonResponse->stringOf("_links.webhook-subscriptions.href");
$v_linksWebhook_subscriptionsType = $jsonResponse->stringOf("_links.webhook-subscriptions.type");
$v_linksWebhook_subscriptionsResource_type = $jsonResponse->stringOf("_links.webhook-subscriptions.resource-type");
$v_linksCustomersHref = $jsonResponse->stringOf("_links.customers.href");
$v_linksCustomersType = $jsonResponse->stringOf("_links.customers.type");
$v_linksCustomersResource_type = $jsonResponse->stringOf("_links.customers.resource-type");

Sample JSON Response Body

{
  "_links": {
    "account": {
      "href": "https://api-sandbox.dwolla.com/accounts/721c463c-c328-4467-882a-f1e5120700b0",
      "type": "application/vnd.dwolla.v1.hal+json",
      "resource-type": "account"
    },
    "events": {
      "href": "https://api-sandbox.dwolla.com/events",
      "type": "application/vnd.dwolla.v1.hal+json",
      "resource-type": "event"
    },
    "webhook-subscriptions": {
      "href": "https://api-sandbox.dwolla.com/webhook-subscriptions",
      "type": "application/vnd.dwolla.v1.hal+json",
      "resource-type": "webhook-subscription"
    },
    "customers": {
      "href": "https://api-sandbox.dwolla.com/customers",
      "type": "application/vnd.dwolla.v1.hal+json",
      "resource-type": "customer"
    }
  }
}