Add new layer to a new Created feature service

03-23-2023 08:47 AM
New Contributor

Hello , 

we are integrated with Esri and i'm trying to do the follwing : 

create new feature service , Then create an layer to it , Finally add features to that  feature layer . 

when i'm using that  methods import { applyEdits, createFeatureService, getAllLayersAndTables, IAddToServiceDefinitionResult, addToServiceDefinition, ICreateServiceResult, ILayerDefinition, queryFeatures, } from '@esri/arcgis-rest-feature-service';
first i create feature service and i can see it created successfully by 

createFeatureService , and pass it's  response.encodedServiceURL to create feature layer 


await addToServiceDefinition(url, {
            authentication: esriContext.auth,
            layers: layerData,
            rawResponse: false,


After response resolved i got success with 200Ok , but indeed feature layer didn't created at esri online  i can find feature service but layer never exist .
Any help around that ?!

Second , 
How can i construct a simple rest full call using postman to addToDefinition seemed the payload for layer must be in type of formData .
https://<S><clientid>ArcGIS/rest/admin/services/<FS names>/FeatureServer/addToDefinition?f=json&token=<mytoken.
but i have no luck i got 




0 Kudos
0 Replies