[Resolved] Internal Transfers

No Support
2 posts

Hello guru,

What am I doing wrong in a C# code?
I’ve tried several encoding types. I can’t figure it out. Thanks a lot!

When I do thru curl such a request
curl -v -X POST -H “Authorization: Bearer CCCCCCC87961ae” -H “Accept: application/vnd.fidor.de; version=1,text/json” -H “Content-Type: application/json” –data ‘{ “account_id” : “1221”, “receiver”: “tracy@gmail.com”, “external_uid” : “E11C59FB-568C-4562-83CE-2E0D02D1A4A2”, “amount” : 87458, “subject” : “Internal transfer 002”}’ https://aps.fidor.de/internal_transfers

it works fine.
In my C# code it keeps saying me the error 422

var handler = new HttpClientHandler();
var httpClient = new HttpClient(handler);
httpClient.DefaultRequestHeaders.TryAddWithoutValidation(“Authorization”, “Bearer CCCCCCC87961ae”);
httpClient.DefaultRequestHeaders.TryAddWithoutValidation(“Accept”, “application/vnd.fidor.de; version=1,text/json”);
httpClient.DefaultRequestHeaders.TryAddWithoutValidation(“Content-Type”, “application/json”);

httpClient.BaseAddress = new Uri(“https://aps.fidor.de”);
var stringContent = new StringContent(“account_id=37635844&receiver=16046526703&external_uid=45645ddd6d46&amount=1500&subject=Test”, Encoding.ASCII);

var result = httpClient.PostAsync(“/internal_transfers”, stringContent).Result;

I found an error, it was in how I create a stringcontent.

You must be logged in to reply in this thread.