Open JosiahParry opened 5 months ago
For reference: https://github.com/R-ArcGIS/arcgislayers/discussions/177#discussioncomment-8929402
@mmachir helped provide a sample POST request which should be easy to mimic in R
request url -
https://services1.arcgis.com/unique-id-here/arcgis/rest/admin/services/heart_binary/FeatureServer/0/addToDefinition
method-
POST
payload -
f:
json
addToDefinition:
{"fields":[{"name":"testfieldname","type":"esriFieldTypeString","alias":"Test Display Name","nullable":true,"editable":true,"length":256,"defaultValue":"~de fault-value!"}]}
token: redacted
This should be fairly simple to mimic:
b_req <- arc_base_req(x[["url"]], path = "addToDefinition")
httr2::req_form_body(
b_req,
fields = fields_json
)
Note that this would allow us to also add related tables https://community.esri.com/t5/arcgis-online-questions/adding-related-table-to-arcgis-online-feature/td-p/252845
this could be a useful workflow when there are tables that have many matches to single polygons. Repeating the polygons is not ideal.
Discussed in https://github.com/R-ArcGIS/arcgislayers/discussions/177