Creating Cutomers using Curl


(Narendran Ra) #1

I am trying to create customer using curl and i am getting below error.

{“code”:“BadRequest”,“message”:“The request body contains bad syntax o
plete.”}* Connection #0 to host api-sandbox.dwolla.com left intact

Following is my code,

curl -X POST -H “Accept: application/vnd.dwolla.v1.hal+json” -H “Content-Type: application/vnd.dwolla.v1.hal+json” -H “Authorization: Bearer RaGkSlYo8oEVLJ8BThdjPcTOTY0loHh565VhBzWt87VnPTlbO0” -d ‘{“firstName”:“Naren”,“lastName”:“Test”,“email”:“narena@directcorp.com”,“ipAddress”: “192.168.2.50”}’ “https://api-sandbox.dwolla.com/customers” -v


(Narendran Ra) #2

hi, any suggestions for my request. Iam trying to do following using curl

  1. Create Token
  2. Create Customer
  3. Attach Accounting details to customer
  4. Initiate Transfer

I was able to create token using curl, but not able to create customer

My syntax for creating customer is as follows:

curl -X POST -H “Accept: application/vnd.dwolla.v1.hal+json” -H “Content-Type: application/json” -H “Authorization: Bearer F1IcTmRO4SRDgzNPrT9hBDP0okJid4ECPYcTngfzTFYN2Dj8He” -d ‘{“firstName”: “Naren”,“lastName”: “Test”,“email”: "naren@directcorp.com",“type”: “receive-only”}’ “https://api-sandbox.dwolla.com/customers” -v

Iam getting below error
{“code”:“BadRequest”,“message”:“The request body contains bad syntax or is incom
plete.”}* Connection #3 to host api-sandbox.dwolla.com left intact

what is wrong with it?


(Spencer Hunter) #3

@Narendran_RA, Im not seeing anything at first glance that would cause issues. The below request worked for me. Try copying that request to see if that works for you. (update access token and request body data)

curl -X POST \
      https://api-sandbox.dwolla.com/customers \
      -H 'Accept: application/vnd.dwolla.v1.hal+json' \
      -H 'Authorization: Bearer SOMEACCESSTOKEN' \
      -H 'Content-type: application/vnd.dwolla.v1.hal+json' \
      -d '{
        "firstName": "firstName",
        "lastName": "lastName",
        "email": "someEmail@email.com",
        "type": "receive-only"
    }'

(Narendran Ra) #4

Thank for the reply. This is fixed now . just changed the code as shown below

curl -H “Content-Type: application/vnd.dwolla.v1.hal+json” -H “Accept: application/vnd.dwolla.v1.hal+json” -H “Authorization: Bearer Ed0fzowWVSilk65GQLzWcLHqxmBNgpmL3vMng56DediWGru9Xj” -d “{“firstName”:“C3”,“lastName”:“H3”,“email”:“ch3@solutioncenter.biz”}” “https://api-sandbox.dwolla.com/customers” -v -k