In the documentation for using handler functions with ArcGIS Server Rest SOE's, they don't explain how the keys in the boundVariables collection are determined. When I search through the entire solution for "customLayersID" I don't see anything. How would I know to use "customLayersID" as a key?

private byte[] CustomLayer(NameValueCollection boundVariables, string outputFormat,
    string requestProperties, out string responseProperties)
    responseProperties = null;

    //The LayerID.
    int layerID = Convert.ToInt32(boundVariables["customLayersID"]);

    CustomLayerInfo layerInfo = GetLayerInfo(layerID);

    string json = layerInfo.ToJsonObject().ToJson();

    return Encoding.UTF8.GetBytes(json);

The bound variable key takes the form of the resource name + "ID".

This is not very clearly stated in the conceptual document you linked to, but I remember seeing it somewhere.

EDIT: See this PDF, slide number 45. Resources seem to be always identified by their identifier (id), which is ok, but I personally find this string-convention-based design very weird. I should also note that the slides are a little outdated and do not exactly match the shipped version of the API.

One last (pedantic) complaint - ESRI will apparently never learn that id is not an abbreviation and as such should not be spelled in uppercase :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.