Permalink
Fetching contributors…
Cannot retrieve contributors at this time
118 lines (117 sloc) 4.26 KB
#N canvas 183 51 1182 689 10;
#X obj 143 145 version;
#X obj 104 94 bng 15 250 50 0 empty empty Warning:_Clicking_here_will_send_data_about_your_Pd_version_to_an_open_databas*
17 7 0 10 -262144 -1 -1;
#X obj 143 173 unpack f f f s s s;
#X msg 143 200 add major \$1;
#X msg 164 224 add minor \$1;
#X msg 185 247 add bugfix \$1;
#X obj 104 383 json-encode;
#X obj 257 414 print json-data;
#X msg 207 271 add distribution \$1;
#X msg 228 295 add compilation-date \$1;
#X msg 247 319 add compilation-time \$1;
#X obj 18 540 print raw-return;
#X obj 6 484 print command;
#X text 488 482 Parameter 1: Base Url;
#X text 488 470 Using 4 parameters to get authentication cookie:;
#X text 488 493 Parameter 2: Path to Login;
#X text 488 516 Parameter 4: Password;
#X text 488 505 Parameter 3: Username;
#X text 200 143 We get version information about Puredata for the statistics
;
#X text 184 382 We create a JSON object from the version information
;
#X text 27 9 This is a simple example for using cookie authentication.
The example sends data to a BigCouch instance hosted by http://cloudant.com/.
;
#X text 26 53 The data will only include information from the output
of [version] \, and nothing else.;
#X obj 449 555 print status-information;
#X obj 104 119 t b b;
#X text 240 445 We store the data;
#X msg 104 424 PUT statistics.php \$1;
#X text 682 55 Different possibilities for authentication:;
#N canvas 44 51 511 356 init 0;
#X obj 32 281 print;
#X text 31 51 Set base url \, login path \, username and password on
initialization;
#X msg 71 157 GET purest-json-stat/_design/statistics/_view/usage_by_distribution?group=true
;
#X msg 32 85 GET purest-json-stat/_design/statistics/_view/usage_by_version?group=true
;
#X obj 32 220 rest https://residuum.cloudant.com/ _session nownestortedidirevinesti
dBukE2WR07A7PtE8FIXECl8c;
#X connect 2 0 4 0;
#X connect 3 0 4 0;
#X connect 4 0 0 0;
#X restore 684 74 pd init with parameters;
#N canvas 229 399 538 332 basic 0;
#X obj 43 294 print;
#X msg 43 89 GET https://nownestortedidirevinesti:dBukE2WR07A7PtE8FIXECl8c@residuum.cloudant.com/purest-json-stat/_design/statistics/_view/usage_by_version?group=true
;
#X msg 74 187 GET https://nownestortedidirevinesti:dBukE2WR07A7PtE8FIXECl8c@residuum.cloudant.com/purest-json-stat/_design/statistics/_view/usage_by_distribution?group=true
;
#X text 39 27 Other possibilities for basic HTTP authentication: send
the username and password seperated by a colon (:) after the specification
of the protocol \, followed by an at sign (@) and the url.;
#X obj 43 267 rest;
#X connect 1 0 4 0;
#X connect 2 0 4 0;
#X connect 4 0 0 0;
#X restore 685 124 pd basic http authentication;
#N canvas 791 397 493 359 basic 0;
#X obj 34 269 print;
#X text 29 38 The trick with : and @ also works for the base url.;
#X msg 77 101 GET usage_by_distribution?group=true;
#X msg 34 64 GET usage_by_version?group=true;
#X obj 34 144 rest https://nownestortedidirevinesti:dBukE2WR07A7PtE8FIXECl8c@residuum.cloudant.com/purest-json-stat/_design/statistics/_view/
;
#X connect 2 0 4 0;
#X connect 3 0 4 0;
#X connect 4 0 0 0;
#X restore 685 148 pd basic http authentication in base url;
#X obj 25 583 import purest_json;
#X obj 104 473 rest http://ix.residuum.org/ login.php puredata statistics
;
#X obj 159 531 json-decode;
#X obj 159 577 print json-data;
#N canvas 565 59 493 359 use 0;
#X obj 41 280 print;
#X msg 88 162 GET purest-json-stat/_design/statistics/_view/usage_by_distribution?group=true
;
#X msg 63 110 GET purest-json-stat/_design/statistics/_view/usage_by_version?group=true
;
#X obj 41 227 rest;
#X msg 22 66 init https://residuum.cloudant.com/ _session nownestortedidirevinesti
dBukE2WR07A7PtE8FIXECl8c;
#X text 21 42 Use the init method to set the parameters;
#X connect 1 0 3 0;
#X connect 2 0 3 0;
#X connect 3 0 0 0;
#X connect 4 0 3 0;
#X restore 685 99 pd use init method;
#X connect 0 0 2 0;
#X connect 1 0 23 0;
#X connect 2 0 3 0;
#X connect 2 1 4 0;
#X connect 2 2 5 0;
#X connect 2 3 8 0;
#X connect 2 4 9 0;
#X connect 2 5 10 0;
#X connect 3 0 6 0;
#X connect 4 0 6 0;
#X connect 5 0 6 0;
#X connect 6 0 7 0;
#X connect 6 0 25 0;
#X connect 8 0 6 0;
#X connect 9 0 6 0;
#X connect 10 0 6 0;
#X connect 23 0 6 0;
#X connect 23 1 0 0;
#X connect 25 0 12 0;
#X connect 25 0 31 0;
#X connect 31 0 11 0;
#X connect 31 0 32 0;
#X connect 31 1 22 0;
#X connect 32 0 33 0;