Ciao Andrea,
thanks for the response.
I 'm working with importer extension on geoserver 2.10.1
I execute this steps:

1. post on http://192.168.1.193:8080/geoserver/rest/imports of this json
{
  "import": {
    "targetStore": {
      "dataStore": {
        "name": "db_public"
      }
    },
    "targetWorkspace": {
      "workspace": {
        "name": "cite"
      }
    }
  }
}
and obtain this response:
{
    "import": {
        "id": 7,
        "href": "http://192.168.1.193:8080/geoserver/rest/imports/7";,
        "state": "PENDING",
        "archive": false,
        "targetWorkspace": {
            "workspace": {
                "name": "cite"
            }
        },
        "targetStore": {
            "dataStore": {
                "name": "db_public",
                "type": "PostGIS"
            }
        },
        "tasks": []
    }
}

2. post on http://192.168.1.193:8080/geoserver/rest/imports/7/tasks
<http://192.168.1.193:8080/geoserver/rest/imports/1/tasks> of a shapefile
zip and obtain this response:

{
    "task": {
        "id": 0,
        "href": "http://192.168.1.193:8080/geoserver/rest/imports/7/tasks/0
",
        "state": "READY",
        "updateMode": "CREATE",
        "data": {
            "type": "file",
            "format": "Shapefile",
            "file": "area1.shp"
        },
        "target": {
            "href": "http://192.168.1.193:8080/geoserver/rest/imports/7/
tasks/0/target",
            "dataStore": {
                "name": "db_public",
                "type": "PostGIS"
            }
        },
        "progress": "http://192.168.1.193:8080/geoserver/rest/imports/7/
tasks/0/progress",
        "layer": {
            "name": "area1",
            "href": "http://192.168.1.193:8080/geoserver/rest/imports/7/
tasks/0/layer"
        },
        "transformChain": {
            "type": "vector",
            "transforms": []
        }
    }
}

3. Now I want update this task to send data in append into an existing
geoserver layer (with the same shapefiles attributes) and I execute a put on
 http://192.168.1.193:8080/geoserver/rest/imports/7/task/0  with this json

{
  "task": {
    "updateMode": "APPEND",
    "layer":{
     "name":"site_boundary"
    }
  }
}

I have a 500 server error with this exception


02 feb 09:27:52 ERROR [geoserver.rest] -
java.lang.NullPointerException
        at org.geoserver.importer.rest.ImportResource.createImport(
ImportResource.java:155)
        at org.geoserver.importer.rest.ImportResource.handlePut(
ImportResource.java:253)
        at org.restlet.Finder.handle(Finder.java:298)
        at org.geoserver.rest.BeanDelegatingRestlet.handle(
BeanDelegatingRestlet.java:38)
        at org.restlet.Filter.doHandle(Filter.java:105)
        at org.restlet.Filter.handle(Filter.java:134)
        at org.restlet.Router.handle(Router.java:444)
        at org.geoserver.rest.RESTDispatcher$1.handle(
RESTDispatcher.java:205)
        at com.noelios.restlet.ext.servlet.ServletConverter.
service(ServletConverter.java:129)
        at org.geoserver.rest.RESTDispatcher.handleRequestInternal(
RESTDispatcher.java:87)
        at org.springframework.web.servlet.mvc.AbstractController.
handleRequest(AbstractController.java:147)
        at org.springframework.web.servlet.mvc.
SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter
.java:50)
        at org.springframework.web.servlet.DispatcherServlet.
doDispatch(DispatcherServlet.java:959)
        at org.springframework.web.servlet.DispatcherServlet.
doService(DispatcherServlet.java:893)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(
FrameworkServlet.java:968)
        at org.springframework.web.servlet.FrameworkServlet.
doPut(FrameworkServlet.java:881)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:651)
        at org.springframework.web.servlet.FrameworkServlet.
service(FrameworkServlet.java:844)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        at  .........

and from geoserver admin interface I see that it was created a new import
with a new id without any task.
What I'm doing wrong?
Thanks.

Giuseppe






2018-02-03 10:56 GMT+01:00 Andrea Aime <[email protected]>:

> Ciao Giuseppe,
> you will have to update your task via a PUT request and switch it to
> "APPEND" mode.
> There are no specific examples on how to do it, but you should be able to
> piece it togheter
> by looking at the reference documentation and existing examples:
> http://docs.geoserver.org/stable/en/user/extensions/
> importer/rest_reference.html#single-task-resource
> http://docs.geoserver.org/latest/en/user/extensions/
> importer/rest_examples.html
>
> Cheers
> Andrea
>
>
> On Thu, Feb 1, 2018 at 4:08 PM, Giuseppe Falcone <
> [email protected]> wrote:
>
>> Hi to all,
>>
>> I want automate a task where a user can upload a shapfile and these data
>> goes (in append) into an existing postgis table configured as a datastore
>> on geoserver.
>> It is possible? I can't find anything about append data ....
>> Thanks a lot.
>>
>>     Giuseppe
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Geoserver-users mailing list
>>
>> Please make sure you read the following two resources before posting to
>> this list:
>> - Earning your support instead of buying it, but Ian Turton:
>> http://www.ianturton.com/talks/foss4g.html#/
>> - The GeoServer user list posting guidelines:
>> http://geoserver.org/comm/userlist-guidelines.html
>>
>> If you want to request a feature or an improvement, also see this:
>> https://github.com/geoserver/geoserver/wiki/Successfully-req
>> uesting-and-integrating-new-features-and-improvements-in-GeoServer
>>
>>
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>
>>
>
>
> --
>
> Regards,
>
> Andrea Aime
>
> ==
> GeoServer Professional Services from the experts! Visit
> http://goo.gl/it488V for more information.
> ==
>
> Ing. Andrea Aime
> @geowolf
> Technical Lead
>
> GeoSolutions S.A.S.
> Via di Montramito 3/A
> <https://maps.google.com/?q=Via+di+Montramito+3/A+55054+%C2%A0Massarosa&entry=gmail&source=g>
> 55054  Massarosa
> <https://maps.google.com/?q=Via+di+Montramito+3/A+55054+%C2%A0Massarosa&entry=gmail&source=g>
> (LU)
> phone: +39 0584 962313 <+39%200584%20962313>
> fax: +39 0584 1660272 <+39%200584%20166%200272>
> mob: +39  339 8844549 <+39%20339%20884%204549>
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
>
> Le informazioni contenute in questo messaggio di posta elettronica e/o
> nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
> loro utilizzo è consentito esclusivamente al destinatario del messaggio,
> per le finalità indicate nel messaggio stesso. Qualora riceviate questo
> messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
> darcene notizia via e-mail e di procedere alla distruzione del messaggio
> stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
> divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
> utilizzarlo per finalità diverse, costituisce comportamento contrario ai
> principi dettati dal D.Lgs. 196/2003.
>
> The information in this message and/or attachments, is intended solely for
> the attention and use of the named addressee(s) and may be confidential or
> proprietary in nature or covered by the provisions of privacy act
> (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
> Code).Any use not in accord with its purpose, any disclosure, reproduction,
> copying, distribution, or either dissemination, either whole or partial, is
> strictly forbidden except previous formal approval of the named
> addressee(s). If you are not the intended recipient, please contact
> immediately the sender by telephone, fax or e-mail and delete the
> information in this message that has been received in error. The sender
> does not give any warranty or accept liability as the content, accuracy or
> completeness of sent messages and accepts no responsibility  for changes
> made after they were sent or for other risks which arise as a result of
> e-mail transmission, viruses, etc.
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to