Hello,
Sorry for disturbing again…
I’m currently trying to do something and I didn’t find answers in the forum. Bwarf… I found answer but it seems not to work anymore (topics of 2019…)
I have a windows service who is a webserver : it’s a REST API that updates title, logs title, calls others services…etc… It use a json payload to get needed data. Like this :
{
"player": "B",
"title": "Dance the night",
"artists": "DUA LIPA",
"playedtime": "04/09/2023 21:03:10",
"type": "piMusic"
}
I found some topics that explain we can use IRESTClient to call REST API with a json. But, when I try it, I got the error "unknow type ‘IRESTClient’.
Here is my code. I don’t understand why IRESTClient doesn’t exist…It is still available ?
procedure OnPlayerStart(PlaylistIndex: integer; PlayerIndex: integer; Item: IPlaylistItem);
var
build_response: IPersistentObject;
client: IRESTClient;
begin
SystemLog('Call of Service');
build_response := Factory.CreatePersistentObject;
build_response.SetString('player', 'RP');
build_response.SetString('title', 'Dance the night');
build_response.SetString('artists', 'DUA LIPA');
build_response.SetString('playedtime', '04/09/202 21:03:10');
build_response.SetString('type', 'piMusic');
//message := build_response2.AsJSon(true, true);
client := CreateRESTClientWithCredentials('https://heaven.local:9080', '', '');
client.PostJSON('/api/save-tile/heaven-rewind', build_response);
end;
Any help would be appreciated !
Regards,
Sylvain