C# 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"

C# Example

Chilkat.Rest rest = new Chilkat.Rest();
bool success;

//  URL: https://api-sandbox.dwolla.com/customers
bool bTls = true;
int port = 443;
bool bAutoReconnect = true;
success = rest.Connect("api-sandbox.dwolla.com",port,bTls,bAutoReconnect);
if (success != true) {
    Debug.WriteLine("ConnectFailReason: " + Convert.ToString(rest.ConnectFailReason));
    Debug.WriteLine(rest.LastErrorText);
    return;
}

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

Chilkat.StringBuilder sbResponseBody = new Chilkat.StringBuilder();
success = rest.FullRequestNoBodySb("GET","/customers",sbResponseBody);
if (success != true) {
    Debug.WriteLine(rest.LastErrorText);
    return;
}

Chilkat.JsonObject jsonResponse = new Chilkat.JsonObject();
jsonResponse.LoadSb(sbResponseBody);

string v_linksSelfHref;
string v_linksSelfType;
string v_linksSelfResource_type;
string v_linksFirstHref;
string v_linksFirstType;
string v_linksFirstResource_type;
string v_linksLastHref;
string v_linksLastType;
string v_linksLastResource_type;
int total;
int i;
int count_i;
string v_linksDeactivateHref;
string v_linksDeactivateType;
string v_linksDeactivateResource_type;
string v_linksEdit_formHref;
string v_linksEdit_formType;
string v_linksEdit_formResource_type;
string v_linksEditHref;
string v_linksEditType;
string v_linksEditResource_type;
string v_linksFunding_sourcesHref;
string v_linksFunding_sourcesType;
string v_linksFunding_sourcesResource_type;
string v_linksTransfersHref;
string v_linksTransfersType;
string v_linksTransfersResource_type;
string id;
string firstName;
string lastName;
string email;
string type;
string status;
string created;
string businessName;

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.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
}