call to Geometry service returns html even after using ?f=json

655
1
05-13-2010 12:48 PM
ClintCabanero
Occasional Contributor
Hello,

I'm performing an 'AreasAndLength' operation against an ESRI geometry service and want to see the response formatted in json.  However, whenever doing [rest url here]&?f=json the response is always formatted as html.

For example:

http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/areasAndLengths?s...[{'rings': [[[2124586.525552436,391037.26363193575], [2126294.593020078,389495.2888095455], [2123363.0568797104,388880.5146625222], [2124586.525552436,391037.26363193575]]]}]&?f=json

Anyone know if this is a problem with the geometry service or does anyone see an error in my REST call?

Thank you
0 Kudos
1 Reply
ClintCabanero
Occasional Contributor
After a few more tries I figured it out.  The solution is to use "&f=json".  So not "?f=json" and not "&?f=son" but "&f=json".

For example:
http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/areasAndLengths?s...[{'rings':%20[[[2124586.525552436,391037.26363193575],%20[2126294.593020078,389495.2888095455],%20[2123363.0568797104,388880.5146625222],%20[2124586.525552436,391037.26363193575]]]}]&f=json

will return the following:
{"areas":[2785215.31992575],"lengths":[7776.03603485512]}
0 Kudos