curl -u winstrom:winstrom -L -f "http://demo.winstrom.eu:5434/c/demo/faktura-vydana/(stavUhrK%20!=%20%27stavUhr.uhrazeno%27).pdf" -o neuhrazene-faktury.pdf
<winstrom version="1.0"> <faktura-vydana> <typDokl>code:FAKTURA</typDokl> <firma>code:WINSTROM</firma> <popis>Moje faktura z CURL</popis> <sumZklZakl>1000.0</sumZklZakl> <bezPolozek>true</bezPolozek> </faktura-vydana> </winstrom>
Nyní již můžeme pustit tento příkaz:
curl -u winstrom:winstrom -f -L http://demo.winstrom.eu:5434/c/demo/faktura-vydana.xml -T faktura.xml
GET /c/moje_firma/faktura-vydana
GET /c/moje_firma/faktura-vydana/1
PUT /c/moje_firma/faktura-vydana
PUT /c/moje_firma/faktura-vydana/1
U výpisu objektů potřebujeme zpracovávat další případy:
?limit=10&start=10
?add-row-count=true
?order=nazev
/ ?order=nazev@A
/ ?order=nazev@D
/c/moje_firma/adresar/1
/c/moje_firma/adresar/code:FIRMA
/c/moje_firma/adresar/vatid:CZ28019920
/c/moje_firma/adresar/ean:8594040311025
/c/moje_firma/adresar/ext:FAKTURACNI1:123
?dry-run=true
?mode=ruby
package cz.priklad.rest; import javax.ws.rs.GET; import javax.ws.rs.Produces; import javax.ws.rs.Path; // Jedná se o komponentu napojenou na URL /hello @Path("/hello") public class HelloResource { @GET // Metoda GET @Produces("text/plain") // Generuje Content-Type text/plain public String getMessage() { return "Haló světe"; // vrátíme tento text } }
// Jedná se o komponentu napojenou na URL /user @Path("/user/{username}") public class UsersResource { @GET // Metoda GET @Produces("text/plain") // Generuje Content-Type text/plain public String getUserAsText(@PathParameter("username") String user) { return user; // vrátíme tento text } @GET // Metoda GET @Produces("text/xml") // Generuje Content-Type text/xml @Path("/xml") // XML je přístupné pod názvem /user/{username}/xml public String getUserAsXml(@PathParameter("username") String user) { return "<xml>" + user + "</xml>"; // vrátíme tento text } }
// Jedná se o komponentu napojenou na URL /user @Path("/user/{username}") public class UsersResource { ... @Path("/log") public LogResource getLog(@PathParameter("username") String user) { return new LogResource(user); } ... } public class LogResource { private String user; public LogResource(String user) { this.user = user; } @GET @Produces("text/plain"); public String getLog() { return "Log for "+user; } }