How to add feature-linked annotation to existing features using REST API?

445
0
05-02-2023 09:14 PM
SergueiSokolov
New Contributor III

The requirement is to replicate what the GP "Annotate Selected Features" does in Pro using REST API call(s). The fact that there is an Apply Edits operation available on the Annotation Layer suggests that it should be possible to create annotations directly via the rest service.

Configuration: AGE10.9.1, ArcGIS Pro 2.9.4, Electric Utility Network Foundation dataset.

We have completed the following steps:
- created a feature-linked annotation class referencing the Utility Network dataset, published as the Feature Layer service
- tested adding a new UN feature using REST API (Add Feature and Apply Edits). Worked as expected, both calls created new UN features with the respective feature-linked annotations. 
- tested adding Annotation to the existing features in Pro using GP Annotate Selected Features . Created a map referencing the UN feature layer, executed GP Annotate Selected Features. Worked as expected, a feature-linked annotation was created for the selected feature.
- tried to use REST API (..server/rest/services/Electric_UN_Annotation/FeatureServer/14/applyEdits) to add feature linked annotations to existing features. The operation doesn’t fail (i.e. it claims success as a result of the post) but the annotation is not created / doesn’t show up. I’m passing the following edits to the Apply Edits of the Annotation feature service
[{"attributes":{
"TextString":"test annotation, N,",
"FeatureGlobalID":"{15D74B0A-B823-436D-B115-9FEBE969A0D5}",
"AnnotationClassID":1,
"Status":0,
"Angle":358.059
},
"geometry":{"rings":[[[356112.8754,198283.8749],[356146.1860,198282.7461],[356146.4548,198191.6771],[356113.1442,198192.8060],[356112.8754,198283.8749]]]}
}]

And the result is
{
"addResults": [{
  "objectId": 34040,
  "globalId": "{54F518C3-1B6D-418F-B4B9-9A3A975C14D1}",
  "success": true
}],
"updateResults": [],
"deleteResults": []
}

What additional steps should be done to create a feature linked annotation for the selected features using REST API? Basically we would like to replicate what GP Annotate Selected Features does but using the REST calls.

Please advise

thank you

Tags (1)
0 Replies