Skip to content

Commit e069d28

Browse files
committed
Add bash curl examples
1 parent 40be702 commit e069d28

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

examples/client_bash.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
curl 'http://localhost/api.php/posts?include=categories,tags,comments&filter=id,eq,1'

examples/client_bash_auth.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
curl 'http://localhost/api.php/' --data "username=admin&password=admin" --cookie-jar cookies.txt --silent >/dev/null
3+
TOKEN=`cat cookies.txt|grep XSRF-TOKEN|cut -f 7`
4+
curl 'http://localhost/api.php/posts?include=categories,tags,comments&filter=id,eq,1' --header "X-XSRF-Token: $TOKEN" --cookie cookies.txt
5+
rm cookies.txt

0 commit comments

Comments
 (0)