FRAMES  NO FRAMES  Description  Parameters  Examples  Response 
URL  http://<geometryserviceurl>/lengths 

Parent Resource  Geometry Service 
The lengths operation is performed on a geometry service resource. This operation calculates the lengths of each polyline specified in the input array.
You can provide arguments to the lengths operation as query parameters defined in the parameters table below.
Parameter  Details 

f  Description: The response format.
The default response format is html. Values: html  json 
polylines  Description: The array of
polylines whose lengths are to be computed. The spatial
reference of the polylines is specified by sr . The structure of each polyline in the array is same as the
structure of the JSON polyline
objects returned by the ArcGIS REST API. Syntax and Examples: JSON Structures:Syntax:[ <polyline1>, <polyline2> ] Example: [ { "paths" : [ [[117,34],[116,34],[117,33]], [[115,44],[114,43],[115,43]] ] }, { "paths" : [ [[32.49,17.83],[31.96,17.59],[30.87,17.01],[30.11,16.86]] ] } ] URL based:For a large set of geometries, you can specify a URL to the input geometries stored in a JSON structure in a file on a public server. The expected format of the file’s contents will be exactly the same as that expected if the polylines were directly embedded in the request.
Syntax: 
sr  Description: The wellknown ID of
the spatial reference or a spatial reference json object for the input polylines . For a list of valid
WKID values, see Projected coordinate Systems
and Geographic coordinate Systems. 
lengthUnit 
Description: The length unit in which perimeters of polygons will be calculated. It can be any esriUnits constant.
If unit is not specified, the units are derived from sr . For a list of valid units, see esriSRUnitTypeconstants and esriSRUnit2Type Constants.

geodesic 
Deprecated at 10.1 Use the calculationType parameter instead.
Description: If polylines are in geographic coordinate system, then geodesic needs to be set to true in order to
calculate the ellipsoidal shortest path distance between each pair of the vertices in the polylines. If lengthUnit is not specificed, then output is always returned in meters.

calculationType 
Description: Type defines the length calculation for the geometry. The type can be of the following values:
"planar": Planar measurements use 2D Cartesian mathematics to calculate length. This type should only be used if the length needs to be calculated in the given spatial reference otherwise use "preserveShape". "geodesic": Use this type if you want to calculate the length using only the vertices of the polyline and define the lines between the points as geodesic segements independent of the actual shape of the polyline. A geodesic segment is the shortest path between two points on an ellipsoid. "preserveShape": This type calculates the length of the geometry on the surface of the Earth ellipsoid, for geometry defined in projected or geographic coordinate system. This method preserves the shape of the geometry in its coordinate system. This means the true length will be calculated for the geometry you see in the map. (What you see is what you get.) 
Example 1: In this example, the lengths of two input polylines are calculated.
http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/lengths?{ "lengths" : [ <length1>, <length2> ]
}
{ "lengths" : [ 456.036465954783, 277.294288451794 ]
}