C# Dwolla: List and Search Transfers for an Account

Back to Index

Shows how to retrieve an Account's list of transfers. Transaction search is supported by passing in optional query string parameters such as: search which represents a term to search on, correlationId, startAmount, endAmount, startDate, endDate, and status.

Documentation: https://docsv2.dwolla.com/#list-and-search-transfers-for-an-account

CURL Command

curl -X GET https://api-sandbox.dwolla.com/accounts/DWOLLA_ACCOUNT_ID/transfers \
-H "Accept: application/vnd.dwolla.v1.hal+json" \
-H "Authorization: Bearer DWOLLA_ACCESS_TOKEN" \
-d "startAmount=1000" \
-d "endAmount=10000" \

C# Example

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

//  URL: https://api-sandbox.dwolla.com/accounts/DWOLLA_ACCOUNT_ID/transfers
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.AddQueryParam("startAmount","1000");
rest.AddQueryParam("endAmount","10000");

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

string strResponseBody = rest.FullRequestFormUrlEncoded("GET","/accounts/DWOLLA_ACCOUNT_ID/transfers");
if (rest.LastMethodSuccess != true) {
    Debug.WriteLine(rest.LastErrorText);
    return;
}

Chilkat.JsonObject jsonResponse = new Chilkat.JsonObject();
jsonResponse.Load(strResponseBody);

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_linksSourceHref;
string v_linksSourceType;
string v_linksSourceResource_type;
string v_linksDestinationHref;
string v_linksDestinationType;
string v_linksDestinationResource_type;
string id;
string status;
string amountValue;
string amountCurrency;
string created;
string clearingSource;
string individualAchId;

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.transfers");
while (i < count_i) {
    jsonResponse.I = i;
    v_linksSelfHref = jsonResponse.StringOf("_embedded.transfers[i]._links.self.href");
    v_linksSelfType = jsonResponse.StringOf("_embedded.transfers[i]._links.self.type");
    v_linksSelfResource_type = jsonResponse.StringOf("_embedded.transfers[i]._links.self.resource-type");
    v_linksSourceHref = jsonResponse.StringOf("_embedded.transfers[i]._links.source.href");
    v_linksSourceType = jsonResponse.StringOf("_embedded.transfers[i]._links.source.type");
    v_linksSourceResource_type = jsonResponse.StringOf("_embedded.transfers[i]._links.source.resource-type");
    v_linksDestinationHref = jsonResponse.StringOf("_embedded.transfers[i]._links.destination.href");
    v_linksDestinationType = jsonResponse.StringOf("_embedded.transfers[i]._links.destination.type");
    v_linksDestinationResource_type = jsonResponse.StringOf("_embedded.transfers[i]._links.destination.resource-type");
    id = jsonResponse.StringOf("_embedded.transfers[i].id");
    status = jsonResponse.StringOf("_embedded.transfers[i].status");
    amountValue = jsonResponse.StringOf("_embedded.transfers[i].amount.value");
    amountCurrency = jsonResponse.StringOf("_embedded.transfers[i].amount.currency");
    created = jsonResponse.StringOf("_embedded.transfers[i].created");
    clearingSource = jsonResponse.StringOf("_embedded.transfers[i].clearing.source");
    individualAchId = jsonResponse.StringOf("_embedded.transfers[i].individualAchId");
    i = i + 1;
}

Sample JSON Response Body

{
  "_links": {
    "self": {
      "href": "https://api-sandbox.dwolla.com/accounts/721c463c-c328-4467-882a-f1e5120700b0/transfers",
      "type": "application/vnd.dwolla.v1.hal+json",
      "resource-type": "transfer"
    },
    "first": {
      "href": "https://api-sandbox.dwolla.com/accounts/721c463c-c328-4467-882a-f1e5120700b0/transfers?&limit=25&offset=0",
      "type": "application/vnd.dwolla.v1.hal+json",
      "resource-type": "transfer"
    },
    "last": {
      "href": "https://api-sandbox.dwolla.com/accounts/721c463c-c328-4467-882a-f1e5120700b0/transfers?&limit=25&offset=0",
      "type": "application/vnd.dwolla.v1.hal+json",
      "resource-type": "transfer"
    }
  },
  "_embedded": {
    "transfers": [
      {
        "_links": {
          "self": {
            "href": "https://api-sandbox.dwolla.com/transfers/0c2650a7-662c-e811-8105-0a595ef38714",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "transfer"
          },
          "source": {
            "href": "https://api-sandbox.dwolla.com/funding-sources/0c5d1842-9a15-4f9f-9b11-b0e73d22e8c7",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "funding-source"
          },
          "destination": {
            "href": "https://api-sandbox.dwolla.com/accounts/721c463c-c328-4467-882a-f1e5120700b0",
            "type": "application/vnd.dwolla.v1.hal+json",
            "resource-type": "account"
          }
        },
        "id": "0c2650a7-662c-e811-8105-0a595ef38714",
        "status": "processed",
        "amount": {
          "value": "5000.00",
          "currency": "USD"
        },
        "created": "2018-03-20T17:46:48.400Z",
        "clearing": {
          "source": "standard"
        },
        "individualAchId": "IDOVVY5E"
      }
    ]
  },
  "total": 1
}