HTTPPost JSON data

HTTPPost('url', '{"track": "test"}');
That seems to be sending as a parameter and not as body, I have no clue what else I can do.


Since I could not figure this out, I’ve resorted to doing it as an argument. Now I have the issue of the song title not being URL-safe. Is there any method to make it URL-safe?

I’ve found a few Delphi methods that can do this ( but I’m not sure how to use these in mAirlist.

This here may work for you.

Replaced regards


Hello @Tondose,

The method you linked would be a really hard method because I would need to account for all characters that appear in song titles.

I don’t have to put it in the URL arguments, I can also send it in the body post data of HTTPPost. But this seems to not be working and gets interpreted as form data instead of JSON.

HTTPPost('', '{"track": "songtitle"}');
HTTPPost('' + current_track, '');

I have also tried HTTPPostRaw, But that seems to mess up the string.

Really all? I should say only the forbidden ones out of the 128 ASCII characters. The rest could be excluded by Ord(Character) > 128.

Economical regards


Alright, I’ll check it out.

One other thing: How can I ignore errors in background scripts and just load them again?

And one other thing, Do you maybe have some kind of example of using that Ord command? I have 0 experience with Delphi.

You can have a look at And, for a start, here.

Ignoring errors? I probably didn’t get you right, what errors do yo mean? Errors by, say, a failed tcp-connection can be handled with the try and except commands. Syntax and runtime errors should be avoided anyway.

Correct regards


Hey @Tondose,

Thank you for your help! I’ve just decided to percent-encode every single character since it doesn’t really matter. I had to make a script since a lot of our at-home DJ’s were using this program and couldn’t send over a title.

// Modified from
function Escape(Oldstring: string): string;
  Newstring, Part, PartUrlSafe: string;
  i, PartInteger: integer;
  Newstring := '';
  for i := 1 to Length(Oldstring) do
      // Get the current iteration letter
      Part := Copy(Oldstring, i, 1);
      // Get the according integer
      PartInteger := Ord(Part[1]);
      // Convert to Hex (Percent encoded)
      PartUrlSafe := '%' + IntToHex(PartInteger, 2);

      Newstring := Newstring + PartUrlSafe;
  Result := Newstring;
1 Like