[Geoserver-users] Adding YSLD-Styles through REST

Hello,

I am trying to add YSLD-Styles through Rest equivalent to this Documentation of SLD-Imports: http://docs.geoserver.org/stable/en/user/rest/api/styles.html
At the end of the first section it says: “Other extensions (such as css) add support for additional formats”.
Unfortunately I haven’t found any documentation for the YSLD-extension regarding this issue.
Is there nevertheless any way to import YSLD-Styles via Rest or is that just possible by converting them into SLDs?
I am using the GeoServer 2.10 Version.

Cheers
Thomas

Hi Thomas,

it should be possible to import YSLD-Styles via REST.
Here are some snippets (curl commands) from a script that we were using to do this:

Step 1: Create the style

curl
-v
-u $USER:$PASSWORD
-XPOST
-H “Content-type: text/xml”
-d “
$YOURSTYLE
ysld
$YOURSTYLE.yaml

1.0.0


http://localhost:8080/geoserver/rest/workspaces/$YOURWORKSPACE/styles

Step 2: Upload the style

curl
-v
-u $USER:$PASSWORD
-XPUT
-H “application/vnd.geoserver.ysld+yaml”
–data-binary @$YOURSTYLE.yaml
http://localhost:8080/geoserver/rest/workspaces/$YOURWORKSPACE/styles/$YOURSTYLE

Step 3 (optional): Assign style

curl
-v
-u $USER:$PASSWORD
-XPUT
-H “Content-type: text/xml”
-d “

$YOURSTYLE
$YOURWORKSPACE


http://localhost:8080/geoserver/rest/layers/$YOURWORKSPACE:$YOURLAYER

Good luck,

Nils

···

Am 07.12.2016 um 12:23 schrieb Thomas-Maximilian.Cuerten@anonymised.com:

Hello,

I am trying to add YSLD-Styles through Rest equivalent to this Documentation of SLD-Imports: http://docs.geoserver.org/stable/en/user/rest/api/styles.html
At the end of the first section it says: “Other extensions (such as css) add support for additional formats”.
Unfortunately I haven’t found any documentation for the YSLD-extension regarding this issue.
Is there nevertheless any way to import YSLD-Styles via Rest or is that just possible by converting them into SLDs?
I am using the GeoServer 2.10 Version.

Cheers
Thomas

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
_______________________________________________
Geoserver-users mailing list
[Geoserver-users@lists.sourceforge.net](mailto:Geoserver-users@anonymised.comsourceforge.net)
[https://lists.sourceforge.net/lists/listinfo/geoserver-users](https://lists.sourceforge.net/lists/listinfo/geoserver-users)

-- 
Dipl.-Inf. Nils Bühner
— Anwendungsentwickler —
terrestris GmbH & Co. KG
Kölnstr. 99
53111 Bonn

Tel:   +49 (0)228 / 96 28 99 -54
Fax:   +49 (0)228 / 96 28 99 -57

Email: [buehner@anonymised.com](mailto:buehner@anonymised.com...)
Web:   [http://www.terrestris.de](http://www.terrestris.de)

Amtsgericht Bonn, HRA 6835
Komplementärin: terrestris Verwaltungsgesellschaft mbH
vertreten durch: Hinrich Paulsen, Till Adams 

Hi Nils,

Thank you for your quick reply. Your commands helped a lot and the import finally works!

Is there any chance that something like this finds its way to the documentation?

Cheers

Thomas

···

Von: Nils Bühner [mailto:buehner@anonymised.com]
Gesendet: Mittwoch, 7. Dezember 2016 13:28
An: Cürten, Thomas Maximilian; geoserver-users@lists.sourceforge.net
Betreff: Re: [Geoserver-users] Adding YSLD-Styles through REST

Hi Thomas,

it should be possible to import YSLD-Styles via REST.
Here are some snippets (curl commands) from a script that we were using to do this:

Step 1: Create the style

curl
-v
-u $USER:$PASSWORD
-XPOST
-H “Content-type: text/xml”
-d “
$YOURSTYLE
ysld
$YOURSTYLE.yaml

1.0.0


http://localhost:8080/geoserver/rest/workspaces/$YOURWORKSPACE/styles

Step 2: Upload the style

curl
-v
-u $USER:$PASSWORD
-XPUT
-H “application/vnd.geoserver.ysld+yaml”
–data-binary @$YOURSTYLE.yaml
http://localhost:8080/geoserver/rest/workspaces/$YOURWORKSPACE/styles/$YOURSTYLE

Step 3 (optional): Assign style

curl
-v
-u $USER:$PASSWORD
-XPUT
-H “Content-type: text/xml”
-d “

$YOURSTYLE
$YOURWORKSPACE


http://localhost:8080/geoserver/rest/layers/$YOURWORKSPACE:$YOURLAYER

Good luck,

Nils

Am 07.12.2016 um 12:23 schrieb Thomas-Maximilian.Cuerten@anonymised.com:

Hello,

I am trying to add YSLD-Styles through Rest equivalent to this Documentation of SLD-Imports: http://docs.geoserver.org/stable/en/user/rest/api/styles.html

At the end of the first section it says: “Other extensions (such as css) add support for additional formats”.

Unfortunately I haven’t found any documentation for the YSLD-extension regarding this issue.

Is there nevertheless any way to import YSLD-Styles via Rest or is that just possible by converting them into SLDs?

I am using the GeoServer 2.10 Version.

Cheers

Thomas

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
_______________________________________________
Geoserver-users mailing list
[Geoserver-users@lists.sourceforge.net](mailto:Geoserver-users@anonymised.comourceforge.net)
[https://lists.sourceforge.net/lists/listinfo/geoserver-users](https://lists.sourceforge.net/lists/listinfo/geoserver-users)
-- 
Dipl.-Inf. Nils Bühner
— Anwendungsentwickler —
terrestris GmbH & Co. KG
Kölnstr. 99
53111 Bonn

Tel:   +49 (0)228 / 96 28 99 -54
Fax:   +49 (0)228 / 96 28 99 -57

Email: [buehner@anonymised.com](mailto:buehner@anonymised.com..)
Web:   [http://www.terrestris.de](http://www.terrestris.de)

Amtsgericht Bonn, HRA 6835
Komplementärin: terrestris Verwaltungsgesellschaft mbH
vertreten durch: Hinrich Paulsen, Till Adams 

On Wed, Dec 7, 2016 at 5:12 PM, <Thomas-Maximilian.Cuerten@anonymised.com>
wrote:

Hi Nils,

Thank you for your quick reply. Your commands helped a lot and the import
finally works!

Is there any chance that something like this finds its way to the
documentation?

The chance is proportional to how much you're willing to put it there
(everybody can contribute docs) :wink:

See here:
http://docs.geoserver.org/latest/en/docguide/quickfix.html
http://docs.geoserver.org/latest/en/docguide/

Cheers
Andrea

--

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
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

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.

-------------------------------------------------------