Hope someone can help, I have got to try and consume a Rest service details here : https://developer.gocardless.com/pro/#integration-guide-collecting-payments
I have had some success using Delphi XE7 for the desktop side, but our website needs some integration
which I am trying to do using Oxygene, We need to be able to setup the initial customers/Bank accounts etc online
I have got a SSL cert setup, The Rest Api uses Basic Authentication then uses calls like
var client := new HttpClient;
client.DefaultRequestHeaders.Authorization := new AuthenticationHeaderValue('basic','username:password');
client.PostAsync(url,new StringContent(jsonText, Encoding.ASCII, 'application/json'));
You probably also need the json.net nuget package to serialize/deserialize json objects.
Thank you for replying. I have installed the 2 packages you mentioned and im attempting to make a GET work but cant seem to get any response? not even an error back. (I have removed my credentials)
This is what i’m trying -
var
GoCardlessUrl :String;
response: HttpResponseMessage;
begin
var client := new HttpClient;
GoCardlessUrl := ‘https://api-sandbox.gocardless.com/customers’;
client.DefaultRequestHeaders.Authorization := new AuthenticationHeaderValue(‘basic’,‘username:password’’’);
client.DefaultRequestHeaders.Add(‘GoCardless-Version’,‘2014-11-03’);
response := await client.GetAsync(GoCardlessUrl);
Label1.Text:= response.Content.ToString;
Thank you for your help so far, you have helped no end.
I can now receive results that I get back in Json.
Do you happen to know the best way to Deserialize json when you don’t know the format you will get back.
im trying
var jsonString := PostTask.result.content.ReadAsStringAsync();
var jsonObj := JsonConvert.DeserializeObject(jsonString);
do you know how you search for key/values on the jsonObj?