Unable to create new funding source for account


(Malcolm Mac Kinnon) #1

The access token is user’s access token with DWOLLA_SCOPE=‘Send|Transactions|Balance|Request|Funding|AccountInfoFull|Scheduled|Email|Contacts|ManageCustomers’

I’ve checked my syntax and can find nothing wrong. Here’s my code (python):

headr={‘Content-Type’:‘application/vnd.dwolla.v1.hal+json’,
‘Accept’:‘application/vnd.dwolla.v1.hal+json’,
‘Authorization’:‘Bearer xtDITbbeb4nSsXyr9CvhycXOA8xfZNn711joLj854jndjeW3Rm’}

par={
“routingNumber”:“222222226”,
“accountNumber”:“123456789”,
“type”:“checking”,
“name”:“My Bank”
}

u=‘https://api-sandbox.dwolla.com/funding-sources

rq=requests.post(url=u, params=par, headers=headr)
<Response [400]>

rq.content

‘{“code”:“BadRequest”,“message”:“The request body contains bad syntax or is incomplete.”}’

Thanks for your help!


(Jared Dellitt) #2

Hey @Malcolm_MacKinnon, params will pass the given object as query parameters. It looks like you may need to use data instead:

rq=requests.post(url=u, data=par, headers=headr)

(Malcolm Mac Kinnon) #3

Thanks, but I still get the same error. Here it is:

rq=requests.post(url=u, data=par, headers=headr)
rq
<Response [400]>

rq.content
’{“code”:“BadRequest”,“message”:“The request body contains bad syntax or is incomplete.”}’


(Malcolm Mac Kinnon) #4

Never mind. You were partially right. I got it to work using this:
rq=requests.post(url=u, data=json.dumps(par), headers=headr)