Trying to call ION API with "POST" method using H5 SDK and the API call needs JSON input.
The call of the API failed and raised an error of "Failed to load resource: the server responded with a status of 400 (Bad Request)"
I tried to pass the JSON input in the body as the following code.
const body = {
// tslint:disable-next-line:max-line-length
'SqlQuery': 'SELECT s.SalesTeamID ,s.NameSTRING ,s.DescriptionSTRING ,sn.Neutral as Name ,sd.Neutral as Description from SalesTeam s left join StringGeneric sn on s.NameSTRING=sn.StringGenericID left join StringGeneric sd on s.DescriptionSTRING=sd.StringGenericID order by sn.Neutral',
'OutputColumnInfo': [
{
'Name': 'SalesTeamID'
},
{
'Name': 'NameSTRING'
},
{
'Name': 'DescriptionSTRING'
},
{
'Name': 'Name'
},
{
'Name': 'Description'
}
]
};
and then set the body in the IIonApiRequest
const request: IIonApiRequest = {
method: 'POST',
url: url,
headers: headers,
source: this.source,
body: body,
responseType: 'json'
};