Perl Dwolla: List and Search Customers

Back to Index

How to retrieve your list of created Customers.

Documentation: https://docsv2.dwolla.com/#list-and-search-customers

CURL Command

curl https://api-sandbox.dwolla.com/customers \
-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/customers
$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","/customers",$sbResponseBody);
if ($success != 1) {
    print $rest->lastErrorText() . "\r\n";
    exit;
}

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

$v_linksSelfHref = $jsonResponse->stringOf("_links.self.href");
$v_linksSelfType = $jsonResponse->stringOf("_links.self.type");
$v_linksSelfResource_type = $jsonResponse->stringOf("_links.self.resource-type");
$v_linksFirstHref = $jsonResponse->stringOf("_links.first.href");
$v_linksFirstType = $jsonResponse->stringOf("_links.first.type");
$v_linksFirstResource_type = $jsonResponse->stringOf("_links.first.resource-type");
$v_linksLastHref = $jsonResponse->stringOf("_links.last.href");
$v_linksLastType = $jsonResponse->stringOf("_links.last.type");
$v_linksLastResource_type = $jsonResponse->stringOf("_links.last.resource-type");
$total = $jsonResponse->IntOf("total");
$i = 0;
$count_i = $jsonResponse->SizeOfArray("_embedded.customers");
while ($i < $count_i) {
    $jsonResponse->put_I($i);
    $v_linksDeactivateHref = $jsonResponse->stringOf("_embedded.customers[i]._links.deactivate.href");
    $v_linksDeactivateType = $jsonResponse->stringOf("_embedded.customers[i]._links.deactivate.type");
    $v_linksDeactivateResource_type = $jsonResponse->stringOf("_embedded.customers[i]._links.deactivate.resource-type");
    $v_linksSelfHref = $jsonResponse->stringOf("_embedded.customers[i]._links.self.href");
    $v_linksSelfType = $jsonResponse->stringOf("_embedded.customers[i]._links.self.type");
    $v_linksSelfResource_type = $jsonResponse->stringOf("_embedded.customers[i]._links.self.resource-type");
    $v_linksEdit_formHref = $jsonResponse->stringOf("_embedded.customers[i]._links.edit-form.href");
    $v_linksEdit_formType = $jsonResponse->stringOf("_embedded.customers[i]._links.edit-form.type");
    $v_linksEdit_formResource_type = $jsonResponse->stringOf("_embedded.customers[i]._links.edit-form.resource-type");
    $v_linksEditHref = $jsonResponse->stringOf("_embedded.customers[i]._links.edit.href");
    $v_linksEditType = $jsonResponse->stringOf("_embedded.customers[i]._links.edit.type");
    $v_linksEditResource_type = $jsonResponse->stringOf("_embedded.customers[i]._links.edit.resource-type");
    $v_linksFunding_sourcesHref = $jsonResponse->stringOf("_embedded.customers[i]._links.funding-sources.href");
    $v_linksFunding_sourcesType = $jsonResponse->stringOf("_embedded.customers[i]._links.funding-sources.type");
    $v_linksFunding_sourcesResource_type = $jsonResponse->stringOf("_embedded.customers[i]._links.funding-sources.resource-type");
    $v_linksTransfersHref = $jsonResponse->stringOf("_embedded.customers[i]._links.transfers.href");
    $v_linksTransfersType = $jsonResponse->stringOf("_embedded.customers[i]._links.transfers.type");
    $v_linksTransfersResource_type = $jsonResponse->stringOf("_embedded.customers[i]._links.transfers.resource-type");
    $id = $jsonResponse->stringOf("_embedded.customers[i].id");
    $firstName = $jsonResponse->stringOf("_embedded.customers[i].firstName");
    $lastName = $jsonResponse->stringOf("_embedded.customers[i].lastName");
    $email = $jsonResponse->stringOf("_embedded.customers[i].email");
    $type = $jsonResponse->stringOf("_embedded.customers[i].type");
    $status = $jsonResponse->stringOf("_embedded.customers[i].status");
    $created = $jsonResponse->stringOf("_embedded.customers[i].created");
    $businessName = $jsonResponse->stringOf("_embedded.customers[i].businessName");
    $i = $i + 1;
}

Sample JSON Response Body

{
  "_links": {
    "self": {
      "href": "https://api-sandbox.dwolla.com/customers",
      "type": "application/vnd.dwolla.v1.hal+json",
      "resource-type": "customer"
    },
    "first": {
      "href": "https://api-sandbox.dwolla.com/customers?limit=25&offset=0",
      "type": "application/vnd.dwolla.v1.hal+json",
      "resource-type": "customer"
    },
    "last": {
      "href": "https://api-sandbox.dwolla.com/customers?limit=25&offset=0",
      "type": "application/vnd.dwolla.v1.hal+json",
      "resource-type": "customer"
    }
  },
  "_embedded": {
    "customers": [
      {
        "_links": {
          "deactivate": {
            "href": "https://api-sandbox.dwolla.com/customers/11371386-80c9-4110-8508-0f307a3fea6d",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "customer"
          },
          "self": {
            "href": "https://api-sandbox.dwolla.com/customers/11371386-80c9-4110-8508-0f307a3fea6d",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "customer"
          },
          "edit-form": {
            "href": "https://api-sandbox.dwolla.com/customers/11371386-80c9-4110-8508-0f307a3fea6d",
            "type": "application/vnd.dwolla.v1.hal+json; profile=\"https://github.com/dwolla/hal-forms\"",
            "resource-type": "customer"
          },
          "edit": {
            "href": "https://api-sandbox.dwolla.com/customers/11371386-80c9-4110-8508-0f307a3fea6d",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "customer"
          },
          "funding-sources": {
            "href": "https://api-sandbox.dwolla.com/customers/11371386-80c9-4110-8508-0f307a3fea6d/funding-sources",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "funding-source"
          },
          "transfers": {
            "href": "https://api-sandbox.dwolla.com/customers/11371386-80c9-4110-8508-0f307a3fea6d/transfers",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "transfer"
          }
        },
        "id": "11371386-80c9-4110-8508-0f307a3fea6d",
        "firstName": "Joe",
        "lastName": "Merchant",
        "email": "jmerchant@@nomail.net",
        "type": "unverified",
        "status": "unverified",
        "created": "2018-03-20T22:07:23.997Z",
        "businessName": "Merchant Joe, Inc."
      }
    ]
  },
  "total": 1
}