Here is the documentation for the distance operation.
https://developers.arcgis.com/rest/services-reference/enterprise/distance.htm
You need to pass the geometries as shown.
{
"geometryType" : "esriGeometryPoint",
"geometry" :
{
"x" : -95.23, "y" : 31.71;
}
}
There's an example URL at the bottom of the page for reference.