I just figured this out.
Here's what I did:
I made a class to represent the Esri Field object:
[Serializable]
public class ESRIFeatureLayerFieldDefinition
{
public string name { get; set; }
public string type { get; set; }
public string alias { get; set; }
public string sqlType { get; set; }
public int length { get; set; }
public bool nullable { get; set; }
public bool editable { get; set; }
public string domain { get; set; }
public string defaultValue { get; set; }
}
from there I created a test field and added it to a list:
ESRIFeatureLayerFieldDefinition addField = new ESRIFeatureLayerFieldDefinition();
addField.name = "TestField14";
addField.type = "esriFieldTypeString";
addField.alias = "TestField14";
addField.sqlType = "sqlTypeOther";
addField.length = 150;
addField.nullable = true;
addField.editable = true;
addField.domain = null;
addField.defaultValue = null;
List<ESRIFeatureLayerFieldDefinition> fieldList = new List<ESRIFeatureLayerFieldDefinition>();
fieldList.Add(addField);
Next, I put that list into a dictionary of type string, object, and gave it a key of "fields":
Dictionary<string, object> fieldArray = new Dictionary<string, object>();
fieldArray["fields"] = fieldList;
I created my RestRequest, specifying it as a "POST" method along with the URL to my service:
RestRequest request = new RestRequest(url, Method.POST);
request.Method = Method.POST;
Then I added a parameter for the fields. The only thing is, the service is looking for a parameter called "addToDefinition" that CONTAINS the fields object. (I found this out after using fiddler to analyze the request when I submitted a request through esri's web admin interface).
So, I have only one parameter in my request and it looks like this:
request.AddParameter("addToDefinition", serializer.Serialize(fieldArray), ParameterType.GetOrPost);
The "addToDefinition" is the name of the parameter that the REST service is looking for. I used a serializer to serialize the fieldArray dictionary object to get the fields JSON object as a string. Parameter type was GetOrPost, and since it's only one it will be passed as the body of the request.
Any additional querystrings or parameters "f=pjson", "token=" were all appended to the resource URL for my request object.
Once that request completes, you should see the new field in your service definition.