Hello All,
Please help me to connect a API.
I have written below code in Business central but getting 400 Error 'Bad request'.
var
Client: HttpClient;
Content: HttpContent;
ResponseMessage: HttpResponseMessage;
dddc: HttpRequestMessage;
Result: Text;
JContent: JsonObject;
JDetails: JsonObject;
JLocations: JsonArray;
JLocation: JsonObject;
JPhones: JsonArray;
JPhone: JsonObject;
CustoData: Record CustoData;
AuthString: Text;
TempBlob: Record TempBlob temporary;
HttpWebRequestMgt: Codeunit "Http Web Request Mgt.";
//ws: Record "Web Service";
begin
Client.DefaultRequestHeaders.Add('Authorization', 'Bearer eyJhbGciOiJSxxxxxxxxxxxxxxxxxxxxxxxxxx2TUg3aGJLVjhrVEZ6eXVmckcxT21pelVtWi1TdGk4Y0RwSlpZIn0.eyJqdGkiOiIzMzQwZDE0OC1jY2UyLTQ0YTEtOGMzNy02Nzg5MzkzM2ZmMWUi'OHBZEWXPUclmkYgLitIMo9zV5BK1GvUdZBmHI3MMIg');
Client.Get('
https://api-sandbox.xxxxxxx.com/corporate-payments-api/1/v1/bulk-payments/messages', ResponseMessage);
ResponseMessage.Content.ReadAs(Result);
Message(Result);
end;
Kindly let me know where am I wrong?
Thanks in advance.