API: How to login and execute Commands?

Hello,

where can i find a documentation for this kind of API(for absolute beginners please)

The best would be a 5min video tutorial, that explains it in 1,2,3 steps.

Without knowing the syntax it is impossible to login or execute commands.

thank you

1 Like

This isn’t exactly what you’re asking for, but the following is a script I use to backup my newsblur data locally; it uses the command-line program “curl” to execute a sequence of operations against the API. Perhaps looking at it will set you on the right track:

 #!/bin/bash 

 if ["x$1" = "x" -o "x$2" = "x"]; then 
 echo "${0} [password] [starred item page count]"; 
 exit 1; 
 fi 

 cookieJar=/tmp/nb-cookies 

 # login to establish an authentication cookie 
 login\_output=$(curl --cookie-jar ${cookieJar} -d username=jsled -d password="$1" http://www.newsblur.com/api/login) 
 # parse my user\_id from the json response 
 user\_id=$(echo $login\_output | jq '.user\_id') 
 echo "parsed user\_id [${user\_id}]" 

 # export subscriptions as OPML 
 curl --cookie ${cookieJar} http://www.newsblur.com/import/opml\_export -o newsblur-subscriptions.opml 

 # save all the pages of starred items. 
 for i in $(seq $2); do 
 curl --cookie ${cookieJar} http://www.newsblur.com/reader/starred\_stories"?page=${i}" -o starred-page-$(printf "%0.2d" ${i}).json; 
 done 

 # export my shared stories 
 curl --cookie ${cookieJar} http://www.newsblur.com/social/stories/${user\_id}/jsled -o shared-stories.json 

 # cleanup 
 #rm ${cookieJar}
1 Like