publicado en nombre del usuario: Eric Thomas. <\/SPAN><\/P>Hola,<\/P><\/P>¿Alguien ha usado la REST API para POSTear un adjunto (photo.png) a un Feature Service usando `addAttachment`? La documentación<\/A> parece incompleta. <\/P><\/P>En Postman:<\/STRONG><\/P>- Método<\/STRONG>: POST<\/P>- URL<\/STRONG>: https:\/\/services1.arcgis.com\/\/ArcGIS\/rest\/services\/\/FeatureServer\/0\/addAttachment?<\/P>- Parámetros POST<\/STRONG>: `token` : `<myToken>, `f` : `json`<\/P>- Cuerpo POST:<\/STRONG><\/P> - Probé con `form-data` con `key` : `attachment` y `value` : `file` y seleccioné un archivo .png. NO FUNCIONÓ<\/P> - Probé con `binary` y seleccioné un archivo .png. NO FUNCIONÓ<\/SPAN><\/P>- Respuesta<\/STRONG>: <\/SPAN><\/P>{ "error": { "code": 400, "message": "Error: Feature (ID: addAttachment) no encontrado", "details": [ "No se puede recuperar el feature." ] }}<\/SPAN><\/P><\/P>La documentación indica que "...Esta operación está disponible solo si la capa ha anunciado que tiene attachments. Una capa tiene attachments si su <\/SPAN>hasAttachments<\/SPAN> <\/SPAN>propiedad es <\/SPAN><\/SPAN>true<\/SPAN>."<\/SPAN><\/SPAN><\/P><\/P>Mi feature service parece<\/EM> tener hasAttachments configurado en true...<\/STRONG><\/SPAN><\/P><\/SPAN><\/P><\/P>...pero se muestra el error cuando pongo esta url en el navegador:https:\/\/services1.arcgis.com\/\/ArcGIS\/rest\/services\/\/FeatureServer\/0\/addAttachment?<\/SPAN><\/P><\/P><\/SPAN><\/P><\/P>¿Alguien puede ver qué me falta? ¿Alguna idea? Gracias<\/P><\/P>Buenos días Eric,<\/P><\/P>Algunas ideas:<\/P>No agregas un attachment a un feature service<\/SPAN>, sino a un feature service feature resource<\/SPAN>, por lo que tu URL debe contener un ID de un feature al que agregar el attachment.<\/LI>(De la documentación<\/>):<\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/>Agrega un attachment usando la operación addAttachment en un recurso feature service feature. En este ejemplo de URL, la operación addAttachment se realiza en el feature ID 818654 perteneciente a la capa 0 del servicio de features 311Incidents:https://services.myserver.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0/818654/addAttachment Pero falta una explicación más detallada)¿Viste este hilo?: <a href=
<\/P>
En Postman:<\/STRONG><\/P>- Método<\/STRONG>: POST<\/P>- URL<\/STRONG>: https:\/\/services1.arcgis.com\/\/ArcGIS\/rest\/services\/\/FeatureServer\/0\/addAttachment?<\/P>- Parámetros POST<\/STRONG>: `token` : `<myToken>, `f` : `json`<\/P>- Cuerpo POST:<\/STRONG><\/P> - Probé con `form-data` con `key` : `attachment` y `value` : `file` y seleccioné un archivo .png. NO FUNCIONÓ<\/P> - Probé con `binary` y seleccioné un archivo .png. NO FUNCIONÓ<\/SPAN><\/P>- Respuesta<\/STRONG>: <\/SPAN><\/P>{ "error": { "code": 400, "message": "Error: Feature (ID: addAttachment) no encontrado", "details": [ "No se puede recuperar el feature." ] }}<\/SPAN><\/P><\/P>La documentación indica que "...Esta operación está disponible solo si la capa ha anunciado que tiene attachments. Una capa tiene attachments si su <\/SPAN>hasAttachments<\/SPAN> <\/SPAN>propiedad es <\/SPAN><\/SPAN>true<\/SPAN>."<\/SPAN><\/SPAN><\/P><\/P>Mi feature service parece<\/EM> tener hasAttachments configurado en true...<\/STRONG><\/SPAN><\/P><\/SPAN><\/P><\/P>...pero se muestra el error cuando pongo esta url en el navegador:https:\/\/services1.arcgis.com\/\/ArcGIS\/rest\/services\/\/FeatureServer\/0\/addAttachment?<\/SPAN><\/P><\/P><\/SPAN><\/P><\/P>¿Alguien puede ver qué me falta? ¿Alguna idea? Gracias<\/P><\/P>Buenos días Eric,<\/P><\/P>Algunas ideas:<\/P>No agregas un attachment a un feature service<\/SPAN>, sino a un feature service feature resource<\/SPAN>, por lo que tu URL debe contener un ID de un feature al que agregar el attachment.<\/LI>(De la
<\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/><\/>Agrega un attachment usando la operación addAttachment en un recurso feature service feature. En este ejemplo de URL, la operación addAttachment se realiza en el feature ID 818654 perteneciente a la capa 0 del servicio de features 311Incidents:https://services.myserver.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0/818654/addAttachment
Hey @ShaningYu - welcome back! The site did recently get a major upgrade. You can post JavaScript related threads to the ArcGIS API for JavaScript channel. Hope this helps, -Peter
I have not used this site for 2 years. The interface has been changed a lot. I would like to know where I can post (JavaScript related) threads. Thanks.
Michelle Mathias do you know if Eric found a way to get the three POST requests working? If there are still unanswered questions here I would recommend creating a case with Esri Support - Support will be able to take a closer look at and troubleshoot the specific workflows.
Thanks,
Peter
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate para una cuenta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.