push data from map to arcgis Online

07-09-2023 07:35 AM
Occasional Contributor III


  In arcgis Online we can upload Geojson after logging into ArcGIS Online. Can we do the same thing from JavaScript using any api i.e we click on a button and the data should be pushed in content of ArcGIS online?




0 Kudos
1 Reply
New Contributor III

Are you looking to create a new item in your content?  If so, I think you'd need to post a request to the ArcGIS REST API for content managment - specifically the addItem API.  You could do this using the esriRequest function from the ArcGIS SDK for JavaScript (I'm not aware off-hand of a specific function for this in the SDK).  You could also consider the createItem method provided by ArcGIS REST JS (a separate library).