Thanks
I try the PUT with this body
{
“updateMode”: “APPEND”,
“layer”: {
“name”: “layerA”,
“nativeName”: “layerA”
}
}
I receive a 500 error with the message ‘updateMode’
I’m using geoserver 2.10.1
for layer REST representation do you mean the response of these?
http://10.23.8.193:8080/geoserver/rest/layers/layerA.html
Thanks
Giuseppe
Il giorno lun 23 mag 2022 alle ore 11:20 Andrea Aime <andrea.aime@anonymised.com> ha scritto:
Hi Giuseppe,
close, but your JSON is one level off, you’re updating the task, so it’s the top level object in the request.
So it would be something like this:
{
“updateMode”: “APPEND”,
“layer”: {
“name”: “layerA”
}
}
Checking a REST script I have handy, inside the layer I also have “nativeName” : “theNativeName” (check the value for nativeName from the layer REST representation).
Cheers
Andrea
On Mon, May 23, 2022 at 11:05 AM Giuseppe Falcone <falcone.giuseppe@anonymised.com> wrote:
Thanks a lot Andrea for the response, but I’m not able to do that
-
POST http://10.23.8.193:8080/geoserver/rest/import to create task import
-
POST http://10.23.8.193:8080/geoserver/rest/import//task to upload shapefile zip (multipart form-data)
-
What is the body of PUT request /geoserver/rest/imports//tasks/ to change target layer name?
I try:
{
“task”:{
“id”: 0,
“href”: “http://10.23.8.193:8080/geoserver/rest/imports/24/tasks/0”,
“updateMode”: “APPEND”,
“layer”: {
“name”: “layerA”
}
}
}
(layerA is a layer on geoserver, on same workspace and same datastore having same fields of uploaded shapefile)
But I receive error “Cannot cast org.geoserver.importer.ImportTask to org.geoserver.catalog.StoreInfo”
Thanks a lot
Giuseppe
Il giorno dom 22 mag 2022 alle ore 17:17 Andrea Aime <andrea.aime@anonymised.com> ha scritto:
On Thu, May 19, 2022 at 9:47 AM Giuseppe Falcone <falcone.giuseppe@anonymised.com> wrote:
Thanks for you response.
I rephrase the question:
I have a web application where a user uploads a shapefile and this needs to be inserted into a postgis table that has the same fields (in append mode). Shapefile and table don’t necessarily have the same name.
There is a manner to execute this task via rest api or importer api?
Use the REST API:
- Set up the context and the shapefile to import
- Use PUT requests against the context to update the import mode (APPEND) and change the target layer name (to the one you want to append to)
- Run the import.
CheersAndrea
==
GeoServer Professional Services from the experts!
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions Group
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 333 8128928
https://www.geosolutionsgroup.com/
http://twitter.com/geosolutions_it
Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.
This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail
–
Regards,
Andrea Aime
==
GeoServer Professional Services from the experts!
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions Group
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 333 8128928
https://www.geosolutionsgroup.com/
http://twitter.com/geosolutions_it
Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.
This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail