This repository has been archived by the owner on May 28, 2019. It is now read-only.
forked from Fotolia/Fotolia-API
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.html
877 lines (816 loc) · 38 KB
/
README.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.4" />
<title>Fotolia API Kits</title>
<style type="text/css">
/* Sans-serif font. */
h1, h2, h3, h4, h5, h6,
div.title, caption.title,
thead, p.table.header,
div#toctitle,
span#author, span#revnumber, span#revdate, span#revremark,
div#footer {
font-family: Arial,Helvetica,sans-serif;
}
/* Serif font. */
div.sectionbody {
font-family: Georgia,"Times New Roman",Times,serif;
}
/* Monospace font. */
tt {
font-size: inherit;
}
body {
margin: 1em 5% 1em 5%;
}
a {
color: blue;
text-decoration: underline;
}
a:visited {
color: fuchsia;
}
em {
font-style: italic;
color: navy;
}
strong {
font-weight: bold;
color: #083194;
}
tt {
font-size: inherit;
color: navy;
}
h1, h2, h3, h4, h5, h6 {
color: #527bbd;
margin-top: 1.2em;
margin-bottom: 0.5em;
line-height: 1.3;
}
h1, h2, h3 {
border-bottom: 2px solid silver;
}
h2 {
padding-top: 0.5em;
}
h3 {
float: left;
}
h3 + * {
clear: left;
}
div.sectionbody {
margin-left: 0;
}
hr {
border: 1px solid silver;
}
p {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
ul, ol, li > p {
margin-top: 0;
}
ul > li { color: #aaa; }
ul > li > * { color: black; }
pre {
padding: 0;
margin: 0;
}
span#author {
color: #527bbd;
font-weight: bold;
font-size: 1.1em;
}
span#email {
}
span#revnumber, span#revdate, span#revremark {
}
div#footer {
font-size: small;
border-top: 2px solid silver;
padding-top: 0.5em;
margin-top: 4.0em;
}
div#footer-text {
float: left;
padding-bottom: 0.5em;
}
div#footer-badges {
float: right;
padding-bottom: 0.5em;
}
div#preamble {
margin-top: 1.5em;
margin-bottom: 1.5em;
}
div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
div.admonitionblock {
margin-top: 1.0em;
margin-bottom: 1.5em;
}
div.admonitionblock {
margin-top: 2.0em;
margin-bottom: 2.0em;
margin-right: 10%;
color: #606060;
}
div.content { /* Block element content. */
padding: 0;
}
/* Block element titles. */
div.title, caption.title {
color: #527bbd;
font-weight: bold;
text-align: left;
margin-top: 1.0em;
margin-bottom: 0.5em;
}
div.title + * {
margin-top: 0;
}
td div.title:first-child {
margin-top: 0.0em;
}
div.content div.title:first-child {
margin-top: 0.0em;
}
div.content + div.title {
margin-top: 0.0em;
}
div.sidebarblock > div.content {
background: #ffffee;
border: 1px solid #dddddd;
border-left: 4px solid #f0f0f0;
padding: 0.5em;
}
div.listingblock > div.content {
border: 1px solid #dddddd;
border-left: 5px solid #f0f0f0;
background: #f8f8f8;
padding: 0.5em;
}
div.quoteblock, div.verseblock {
padding-left: 1.0em;
margin-left: 1.0em;
margin-right: 10%;
border-left: 5px solid #f0f0f0;
color: #777777;
}
div.quoteblock > div.attribution {
padding-top: 0.5em;
text-align: right;
}
div.verseblock > pre.content {
font-family: inherit;
font-size: inherit;
}
div.verseblock > div.attribution {
padding-top: 0.75em;
text-align: left;
}
/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
div.verseblock + div.attribution {
text-align: left;
}
div.admonitionblock .icon {
vertical-align: top;
font-size: 1.1em;
font-weight: bold;
text-decoration: underline;
color: #527bbd;
padding-right: 0.5em;
}
div.admonitionblock td.content {
padding-left: 0.5em;
border-left: 3px solid #dddddd;
}
div.exampleblock > div.content {
border-left: 3px solid #dddddd;
padding-left: 0.5em;
}
div.imageblock div.content { padding-left: 0; }
span.image img { border-style: none; }
a.image:visited { color: white; }
dl {
margin-top: 0.8em;
margin-bottom: 0.8em;
}
dt {
margin-top: 0.5em;
margin-bottom: 0;
font-style: normal;
color: navy;
}
dd > *:first-child {
margin-top: 0.1em;
}
ul, ol {
list-style-position: outside;
}
ol.arabic {
list-style-type: decimal;
}
ol.loweralpha {
list-style-type: lower-alpha;
}
ol.upperalpha {
list-style-type: upper-alpha;
}
ol.lowerroman {
list-style-type: lower-roman;
}
ol.upperroman {
list-style-type: upper-roman;
}
div.compact ul, div.compact ol,
div.compact p, div.compact p,
div.compact div, div.compact div {
margin-top: 0.1em;
margin-bottom: 0.1em;
}
div.tableblock > table {
border: 3px solid #527bbd;
}
thead, p.table.header {
font-weight: bold;
color: #527bbd;
}
tfoot {
font-weight: bold;
}
td > div.verse {
white-space: pre;
}
p.table {
margin-top: 0;
}
/* Because the table frame attribute is overriden by CSS in most browsers. */
div.tableblock > table[frame="void"] {
border-style: none;
}
div.tableblock > table[frame="hsides"] {
border-left-style: none;
border-right-style: none;
}
div.tableblock > table[frame="vsides"] {
border-top-style: none;
border-bottom-style: none;
}
div.hdlist {
margin-top: 0.8em;
margin-bottom: 0.8em;
}
div.hdlist tr {
padding-bottom: 15px;
}
dt.hdlist1.strong, td.hdlist1.strong {
font-weight: bold;
}
td.hdlist1 {
vertical-align: top;
font-style: normal;
padding-right: 0.8em;
color: navy;
}
td.hdlist2 {
vertical-align: top;
}
div.hdlist.compact tr {
margin: 0;
padding-bottom: 0;
}
.comment {
background: yellow;
}
.footnote, .footnoteref {
font-size: 0.8em;
}
span.footnote, span.footnoteref {
vertical-align: super;
}
#footnotes {
margin: 20px 0 20px 0;
padding: 7px 0 0 0;
}
#footnotes div.footnote {
margin: 0 0 5px 0;
}
#footnotes hr {
border: none;
border-top: 1px solid silver;
height: 1px;
text-align: left;
margin-left: 0;
width: 20%;
min-width: 100px;
}
div.colist td {
padding-right: 0.5em;
padding-bottom: 0.3em;
vertical-align: top;
}
div.colist td img {
margin-top: 0.3em;
}
@media print {
div#footer-badges { display: none; }
}
div#toc {
margin-bottom: 2.5em;
}
div#toctitle {
color: #527bbd;
font-size: 1.1em;
font-weight: bold;
margin-top: 1.0em;
margin-bottom: 0.1em;
}
div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
margin-top: 0;
margin-bottom: 0;
}
div.toclevel2 {
margin-left: 2em;
font-size: 0.9em;
}
div.toclevel3 {
margin-left: 4em;
font-size: 0.9em;
}
div.toclevel4 {
margin-left: 6em;
font-size: 0.9em;
}
span.aqua { color: aqua; }
span.black { color: black; }
span.blue { color: blue; }
span.fuchsia { color: fuchsia; }
span.gray { color: gray; }
span.green { color: green; }
span.lime { color: lime; }
span.maroon { color: maroon; }
span.navy { color: navy; }
span.olive { color: olive; }
span.purple { color: purple; }
span.red { color: red; }
span.silver { color: silver; }
span.teal { color: teal; }
span.white { color: white; }
span.yellow { color: yellow; }
span.aqua-background { background: aqua; }
span.black-background { background: black; }
span.blue-background { background: blue; }
span.fuchsia-background { background: fuchsia; }
span.gray-background { background: gray; }
span.green-background { background: green; }
span.lime-background { background: lime; }
span.maroon-background { background: maroon; }
span.navy-background { background: navy; }
span.olive-background { background: olive; }
span.purple-background { background: purple; }
span.red-background { background: red; }
span.silver-background { background: silver; }
span.teal-background { background: teal; }
span.white-background { background: white; }
span.yellow-background { background: yellow; }
span.big { font-size: 2em; }
span.small { font-size: 0.6em; }
</style>
<script type="text/javascript">
/*<![CDATA[*/
window.onload = function(){asciidoc.footnotes();}
var asciidoc = { // Namespace.
/////////////////////////////////////////////////////////////////////
// Table Of Contents generator
/////////////////////////////////////////////////////////////////////
/* Author: Mihai Bazon, September 2002
* http://students.infoiasi.ro/~mishoo
*
* Table Of Content generator
* Version: 0.4
*
* Feel free to use this script under the terms of the GNU General Public
* License, as long as you do not remove or alter this notice.
*/
/* modified by Troy D. Hanson, September 2006. License: GPL */
/* modified by Stuart Rackham, 2006, 2009. License: GPL */
// toclevels = 1..4.
toc: function (toclevels) {
function getText(el) {
var text = "";
for (var i = el.firstChild; i != null; i = i.nextSibling) {
if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
text += i.data;
else if (i.firstChild != null)
text += getText(i);
}
return text;
}
function TocEntry(el, text, toclevel) {
this.element = el;
this.text = text;
this.toclevel = toclevel;
}
function tocEntries(el, toclevels) {
var result = new Array;
var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
// Function that scans the DOM tree for header elements (the DOM2
// nodeIterator API would be a better technique but not supported by all
// browsers).
var iterate = function (el) {
for (var i = el.firstChild; i != null; i = i.nextSibling) {
if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
var mo = re.exec(i.tagName);
if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
}
iterate(i);
}
}
}
iterate(el);
return result;
}
var toc = document.getElementById("toc");
var entries = tocEntries(document.getElementById("content"), toclevels);
for (var i = 0; i < entries.length; ++i) {
var entry = entries[i];
if (entry.element.id == "")
entry.element.id = "_toc_" + i;
var a = document.createElement("a");
a.href = "#" + entry.element.id;
a.appendChild(document.createTextNode(entry.text));
var div = document.createElement("div");
div.appendChild(a);
div.className = "toclevel" + entry.toclevel;
toc.appendChild(div);
}
if (entries.length == 0)
toc.parentNode.removeChild(toc);
},
/////////////////////////////////////////////////////////////////////
// Footnotes generator
/////////////////////////////////////////////////////////////////////
/* Based on footnote generation code from:
* http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
*/
footnotes: function () {
var cont = document.getElementById("content");
var noteholder = document.getElementById("footnotes");
var spans = cont.getElementsByTagName("span");
var refs = {};
var n = 0;
for (i=0; i<spans.length; i++) {
if (spans[i].className == "footnote") {
n++;
// Use [\s\S] in place of . so multi-line matches work.
// Because JavaScript has no s (dotall) regex flag.
note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
noteholder.innerHTML +=
"<div class='footnote' id='_footnote_" + n + "'>" +
"<a href='#_footnoteref_" + n + "' title='Return to text'>" +
n + "</a>. " + note + "</div>";
spans[i].innerHTML =
"[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
"' title='View footnote' class='footnote'>" + n + "</a>]";
var id =spans[i].getAttribute("id");
if (id != null) refs["#"+id] = n;
}
}
if (n == 0)
noteholder.parentNode.removeChild(noteholder);
else {
// Process footnoterefs.
for (i=0; i<spans.length; i++) {
if (spans[i].className == "footnoteref") {
var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
href = href.match(/#.*/)[0]; // Because IE return full URL.
n = refs[href];
spans[i].innerHTML =
"[<a href='#_footnote_" + n +
"' title='View footnote' class='footnote'>" + n + "</a>]";
}
}
}
}
}
/*]]>*/
</script>
</head>
<body class="article">
<div id="header">
<h1>Fotolia API Kits</h1>
<span id="author">Olivier Sirven</span><br />
<span id="email"><tt><<a href="mailto:[email protected]">[email protected]</a>></tt></span><br />
</div>
<div id="content">
<div class="sect1">
<h2 id="_introduction">Introduction</h2>
<div class="sectionbody">
<div class="paragraph"><p>Fotolia’s industry-leading API allows developers and businesses to
quickly integrate a vast database of images in their workflows and
business models.</p></div>
<div class="paragraph"><p>Whether you’re developing an application with millions of photos, or
integrating a stock photography library into your business to increase
customer satisfaction, Fotolia’s powerful APIs are key. But technical
excellence is only part of the formula – our business development team
will work with you to determine the best way to maximize results.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_fotolia_s_api_line_up">Fotolia’s API line-up</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_partner_api">Partner API</h3>
<div class="paragraph"><p>Our Partner API allows you to embed royalty-free image search into
your website.</p></div>
<div class="ulist"><ul>
<li>
<p>
Your customers may search the entire Fotolia library to find images
without leaving your website.
</p>
</li>
<li>
<p>
After finding the perfect image, your customer clicks through to us to
buy.
</p>
</li>
<li>
<p>
Since our Affiliate Program is also built into this API, we
automatically pay you for all revenues generated.
</p>
</li>
</ul></div>
<div class="paragraph"><p><a href="http://www.fotolia.com/Services/API/Partner">Learn more</a></p></div>
</div>
<div class="sect2">
<h3 id="_business_api">Business API</h3>
<div class="paragraph"><p>Our Business API is for on-demand businesses producing custom
merchandise and products, including web site templates and printed
materials.</p></div>
<div class="ulist"><ul>
<li>
<p>
Your customers will gain access to high-resolution images directly
within your application or web-based tool.
</p>
</li>
<li>
<p>
Wholesale pricing is available.
</p>
</li>
<li>
<p>
You can also use this API to embed Fotolia into your intranet or
application to make search and download faster.
</p>
</li>
</ul></div>
<div class="paragraph"><p><a href="http://www.fotolia.com/Services/API/Business">Learn more</a></p></div>
</div>
<div class="sect2">
<h3 id="_reseller_api">Reseller API</h3>
<div class="paragraph"><p>Our Reseller API allows you to sell Fotolia’s images under your brand name to your customers.</p></div>
<div class="ulist"><ul>
<li>
<p>
Access Fotolia’s entire microstock image library, with full search
and download capability.
</p>
</li>
<li>
<p>
A complete white-label solution, available in select markets around
the world.
</p>
</li>
</ul></div>
<div class="paragraph"><p><a href="http://www.fotolia.com/Services/API/Reseller">Learn more</a></p></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_content_of_this_package">Content of this package</h2>
<div class="sectionbody">
<div class="paragraph"><p>This package contains a full implementation of the API for PHP, python
and java. Each provides an example file to show how to use it.</p></div>
<div class="sect2">
<h3 id="_php">PHP</h3>
<div class="paragraph"><p>Requirements:</p></div>
<div class="ulist"><ul>
<li>
<p>
<a href="http://www.php.net">PHP >= 5.2</a>
</p>
</li>
<li>
<p>
<a href="http://www.php.net/curl">PHP cURL extension</a>
</p>
</li>
</ul></div>
<div class="listingblock">
<div class="title">Example usage</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.4
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="color: #000000">00001:</span> #!/usr/bin/env php
<span style="color: #000000">00002:</span> <span style="color: #990000"><?php</span>
<span style="color: #000000">00003:</span>
<span style="color: #000000">00004:</span> <span style="font-weight: bold"><span style="color: #000080">require_once</span></span> <span style="color: #FF0000">'fotolia_api.php'</span><span style="color: #990000">;</span>
<span style="color: #000000">00005:</span>
<span style="color: #000000">00006:</span> <span style="color: #009900">$api</span> <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">new</span></span> <span style="font-weight: bold"><span style="color: #000000">Fotolia_Api</span></span><span style="color: #990000">(</span><span style="color: #FF0000">'your_api_key'</span><span style="color: #990000">);</span>
<span style="color: #000000">00007:</span>
<span style="color: #000000">00008:</span> <span style="font-style: italic"><span style="color: #9A1900">// searching for files</span></span>
<span style="color: #000000">00009:</span> <span style="color: #009900">$results</span> <span style="color: #990000">=</span> <span style="color: #009900">$api</span><span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">getSearchResults</span></span><span style="color: #990000">(</span>
<span style="color: #000000">00010:</span> <span style="font-weight: bold"><span style="color: #0000FF">array</span></span><span style="color: #990000">(</span>
<span style="color: #000000">00011:</span> <span style="color: #FF0000">'words'</span> <span style="color: #990000">=></span> <span style="color: #FF0000">'car'</span><span style="color: #990000">,</span>
<span style="color: #000000">00012:</span> <span style="color: #FF0000">'language_id'</span> <span style="color: #990000">=></span> Fotolia_Api<span style="color: #990000">::</span>LANGUAGE_ID_EN_US<span style="color: #990000">,</span>
<span style="color: #000000">00013:</span> <span style="color: #FF0000">'limit'</span> <span style="color: #990000">=></span> <span style="color: #993399">1</span><span style="color: #990000">,</span>
<span style="color: #000000">00014:</span> <span style="color: #990000">));</span>
<span style="color: #000000">00015:</span>
<span style="color: #000000">00016:</span> <span style="font-weight: bold"><span style="color: #000000">printf</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"Found %d results"</span><span style="color: #990000">,</span> <span style="color: #009900">$results</span><span style="color: #990000">[</span><span style="color: #FF0000">'nb_results'</span><span style="color: #990000">]);</span>
<span style="color: #000000">00017:</span>
<span style="color: #000000">00018:</span> <span style="font-weight: bold"><span style="color: #0000FF">foreach</span></span> <span style="color: #990000">(</span><span style="color: #009900">$results</span> <span style="font-weight: bold"><span style="color: #0000FF">as</span></span> <span style="color: #009900">$key</span> <span style="color: #990000">=></span> <span style="color: #009900">$value</span><span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
<span style="color: #000000">00019:</span> <span style="font-style: italic"><span style="color: #9A1900">// iterating only over numeric keys and silently skip other keys</span></span>
<span style="color: #000000">00020:</span> <span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">(</span><span style="font-weight: bold"><span style="color: #000000">is_numeric</span></span><span style="color: #990000">(</span><span style="color: #009900">$key</span><span style="color: #990000">))</span> <span style="color: #FF0000">{</span>
<span style="color: #000000">00021:</span> <span style="font-weight: bold"><span style="color: #000000">printf</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"matching media ID: %d"</span><span style="color: #990000">,</span> <span style="color: #009900">$value</span><span style="color: #990000">[</span><span style="color: #FF0000">'id'</span><span style="color: #990000">]);</span>
<span style="color: #000000">00022:</span> <span style="color: #FF0000">}</span>
<span style="color: #000000">00023:</span> <span style="color: #FF0000">}</span>
<span style="color: #000000">00024:</span>
<span style="color: #000000">00025:</span> <span style="font-style: italic"><span style="color: #9A1900">// loggin in and retrieving user data</span></span>
<span style="color: #000000">00026:</span> <span style="color: #009900">$api</span><span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">loginUser</span></span><span style="color: #990000">(</span><span style="color: #FF0000">'your_login'</span><span style="color: #990000">,</span> <span style="color: #FF0000">'your_password'</span><span style="color: #990000">);</span>
<span style="color: #000000">00027:</span> <span style="font-weight: bold"><span style="color: #000000">print_r</span></span><span style="color: #990000">(</span>$api<span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">getUserData</span></span><span style="color: #990000">());</span>
<span style="color: #000000">00028:</span>
<span style="color: #000000">00029:</span> <span style="font-style: italic"><span style="color: #9A1900">// purchasing and downloading a file</span></span>
<span style="color: #000000">00030:</span> <span style="color: #009900">$dl_data</span> <span style="color: #990000">=</span> <span style="color: #009900">$api</span><span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">getMedia</span></span><span style="color: #990000">(</span><span style="color: #993399">35957426</span><span style="color: #990000">,</span> <span style="color: #FF0000">'XS'</span><span style="color: #990000">);</span>
<span style="color: #000000">00031:</span> <span style="color: #009900">$api</span><span style="color: #990000">-></span><span style="font-weight: bold"><span style="color: #000000">downloadMedia</span></span><span style="color: #990000">(</span><span style="color: #009900">$dl_data</span><span style="color: #990000">[</span><span style="color: #FF0000">'url'</span><span style="color: #990000">],</span> <span style="color: #FF0000">'/tmp/'</span> <span style="color: #990000">+</span> <span style="color: #009900">$dl_data</span><span style="color: #990000">[</span><span style="color: #FF0000">'name'</span><span style="color: #990000">]);</span></tt></pre></div></div>
</div>
<div class="sect2">
<h3 id="_python">Python</h3>
<div class="paragraph"><p>Requirements:</p></div>
<div class="ulist"><ul>
<li>
<p>
<a href="http://python.org/">Python >= 2.7</a>
</p>
</li>
<li>
<p>
<a href="http://pycurl.sourceforge.net/">pycurl extension</a>
</p>
</li>
</ul></div>
<div class="listingblock">
<div class="title">Example usage</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.4
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="color: #000000">00001:</span> <span style="font-style: italic"><span style="color: #9A1900">#!/usr/bin/env python</span></span>
<span style="color: #000000">00002:</span>
<span style="color: #000000">00003:</span> <span style="font-weight: bold"><span style="color: #000080">import</span></span> fotolia_api
<span style="color: #000000">00004:</span>
<span style="color: #000000">00005:</span> api <span style="color: #990000">=</span> fotolia_api<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">FotoliaApi</span></span><span style="color: #990000">(</span><span style="color: #FF0000">'your_api_key'</span><span style="color: #990000">)</span>
<span style="color: #000000">00006:</span>
<span style="color: #000000">00007:</span> <span style="font-style: italic"><span style="color: #9A1900"># searching for files</span></span>
<span style="color: #000000">00008:</span> results <span style="color: #990000">=</span> api<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">get_search_results</span></span><span style="color: #990000">({</span><span style="color: #FF0000">'words'</span><span style="color: #990000">:</span> <span style="color: #FF0000">'car'</span><span style="color: #990000">,</span> <span style="color: #FF0000">'language_id'</span><span style="color: #990000">:</span> fotolia_api<span style="color: #990000">.</span>LANGUAGE_ID_EN_US<span style="color: #990000">,</span> <span style="color: #FF0000">'limit'</span><span style="color: #990000">:</span> <span style="color: #993399">1</span><span style="color: #990000">})</span>
<span style="color: #000000">00009:</span> <span style="font-weight: bold"><span style="color: #0000FF">print</span></span> <span style="color: #FF0000">"Found %d results"</span> <span style="color: #990000">%</span> results<span style="color: #990000">[</span><span style="color: #FF0000">'nb_results'</span><span style="color: #990000">]</span>
<span style="color: #000000">00010:</span>
<span style="color: #000000">00011:</span> <span style="font-weight: bold"><span style="color: #0000FF">for</span></span> key<span style="color: #990000">,</span> value <span style="font-weight: bold"><span style="color: #0000FF">in</span></span> results<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">items</span></span><span style="color: #990000">():</span>
<span style="color: #000000">00012:</span> <span style="font-weight: bold"><span style="color: #0000FF">try</span></span><span style="color: #990000">:</span>
<span style="color: #000000">00013:</span> <span style="font-weight: bold"><span style="color: #000000">int</span></span><span style="color: #990000">(</span>key<span style="color: #990000">)</span>
<span style="color: #000000">00014:</span> <span style="font-weight: bold"><span style="color: #0000FF">print</span></span> <span style="color: #FF0000">"matching media ID: %d"</span> <span style="color: #990000">%</span> value<span style="color: #990000">[</span><span style="color: #FF0000">'id'</span><span style="color: #990000">]</span>
<span style="color: #000000">00015:</span> <span style="font-weight: bold"><span style="color: #0000FF">except</span></span> ValueError<span style="color: #990000">:</span>
<span style="color: #000000">00016:</span> <span style="font-style: italic"><span style="color: #9A1900"># iterating only over numeric keys and silently skip other keys</span></span>
<span style="color: #000000">00017:</span> <span style="font-weight: bold"><span style="color: #0000FF">pass</span></span>
<span style="color: #000000">00018:</span>
<span style="color: #000000">00019:</span> <span style="font-style: italic"><span style="color: #9A1900"># loggin in and retrieving user data</span></span>
<span style="color: #000000">00020:</span> api<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">login_user</span></span><span style="color: #990000">(</span><span style="color: #FF0000">'your_login'</span><span style="color: #990000">,</span> <span style="color: #FF0000">'your_password'</span><span style="color: #990000">)</span>
<span style="color: #000000">00021:</span> <span style="font-weight: bold"><span style="color: #0000FF">print</span></span> api<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">get_user_data</span></span><span style="color: #990000">()</span>
<span style="color: #000000">00022:</span>
<span style="color: #000000">00023:</span> <span style="font-style: italic"><span style="color: #9A1900"># purchasing and downloading a file</span></span>
<span style="color: #000000">00024:</span> dl_data <span style="color: #990000">=</span> api<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">get_media</span></span><span style="color: #990000">(</span><span style="color: #993399">35957426</span><span style="color: #990000">,</span> <span style="color: #FF0000">'XS'</span><span style="color: #990000">)</span>
<span style="color: #000000">00025:</span> api<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">download_media</span></span><span style="color: #990000">(</span>dl_data<span style="color: #990000">[</span><span style="color: #FF0000">'url'</span><span style="color: #990000">],</span> <span style="color: #FF0000">'/tmp/'</span> <span style="color: #990000">+</span> <span style="font-weight: bold"><span style="color: #000000">str</span></span><span style="color: #990000">(</span>dl_data<span style="color: #990000">[</span><span style="color: #FF0000">'name'</span><span style="color: #990000">]))</span></tt></pre></div></div>
</div>
<div class="sect2">
<h3 id="_java">Java</h3>
<div class="paragraph"><p>Requirements:</p></div>
<div class="ulist"><ul>
<li>
<p>
<a href="http://hc.apache.org">apache common HTTP client</a>
</p>
</li>
<li>
<p>
<a href="http://code.google.com/p/json-simple/">json simple</a>
</p>
</li>
<li>
<p>
<a href="http://www.java.com">java JDK >= 6.26</a>
</p>
</li>
</ul></div>
<div class="paragraph"><p>A simple Makefile is provided to help using it. It supports following
commands:</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
build
</dt>
<dd>
<p>
Build the entire package
</p>
</dd>
<dt class="hdlist1">
jar
</dt>
<dd>
<p>
Create a JAR file for easy inclusion
</p>
</dd>
<dt class="hdlist1">
clean
</dt>
<dd>
<p>
Clean the build files
</p>
</dd>
<dt class="hdlist1">
example
</dt>
<dd>
<p>
Build the example program
</p>
</dd>
</dl></div>
<div class="listingblock">
<div class="title">Example usage</div>
<div class="content"><!-- Generator: GNU source-highlight 3.1.4
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="color: #000000">00001:</span> <span style="font-weight: bold"><span style="color: #000080">import</span></span> org<span style="color: #990000">.</span>webservice<span style="color: #990000">.</span>fotolia<span style="color: #990000">.*;</span>
<span style="color: #000000">00002:</span> <span style="font-weight: bold"><span style="color: #000080">import</span></span> org<span style="color: #990000">.</span>json<span style="color: #990000">.</span>simple<span style="color: #990000">.</span>JSONObject<span style="color: #990000">;</span>
<span style="color: #000000">00003:</span>
<span style="color: #000000">00004:</span> <span style="font-weight: bold"><span style="color: #0000FF">public</span></span> <span style="font-weight: bold"><span style="color: #0000FF">class</span></span> <span style="color: #008080">example</span>
<span style="color: #000000">00005:</span> <span style="color: #FF0000">{</span>
<span style="color: #000000">00006:</span> <span style="font-weight: bold"><span style="color: #0000FF">public</span></span> <span style="font-weight: bold"><span style="color: #0000FF">static</span></span> <span style="color: #009900">void</span> <span style="font-weight: bold"><span style="color: #000000">main</span></span><span style="color: #990000">(</span>String<span style="color: #990000">[]</span> args<span style="color: #990000">)</span>
<span style="color: #000000">00007:</span> <span style="color: #FF0000">{</span>
<span style="color: #000000">00008:</span> <span style="color: #008080">FotoliaApi</span> client <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">new</span></span> <span style="font-weight: bold"><span style="color: #000000">FotoliaApi</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"your_api_key"</span><span style="color: #990000">);</span>
<span style="color: #000000">00009:</span>
<span style="color: #000000">00010:</span> <span style="font-style: italic"><span style="color: #9A1900">// fetching a media data</span></span>
<span style="color: #000000">00011:</span> System<span style="color: #990000">.</span>out<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">println</span></span><span style="color: #990000">(</span>client<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">getMediaData</span></span><span style="color: #990000">(</span><span style="color: #993399">18136053</span><span style="color: #990000">));</span>
<span style="color: #000000">00012:</span>
<span style="color: #000000">00013:</span> <span style="font-style: italic"><span style="color: #9A1900">// searching files</span></span>
<span style="color: #000000">00014:</span> <span style="color: #008080">FotoliaSearchQuery</span> query <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">new</span></span> <span style="font-weight: bold"><span style="color: #000000">FotoliaSearchQuery</span></span><span style="color: #990000">();</span>
<span style="color: #000000">00015:</span> query<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">setWords</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"car"</span><span style="color: #990000">).</span><span style="font-weight: bold"><span style="color: #000000">setLanguageId</span></span><span style="color: #990000">(</span>FotoliaApi<span style="color: #990000">.</span>LANGUAGE_ID_EN_US<span style="color: #990000">).</span><span style="font-weight: bold"><span style="color: #000000">setLimit</span></span><span style="color: #990000">(</span><span style="color: #993399">1</span><span style="color: #990000">);</span>
<span style="color: #000000">00016:</span> System<span style="color: #990000">.</span>out<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">println</span></span><span style="color: #990000">(</span>client<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">getSearchResults</span></span><span style="color: #990000">(</span>query<span style="color: #990000">));</span>
<span style="color: #000000">00017:</span>
<span style="color: #000000">00018:</span> <span style="font-style: italic"><span style="color: #9A1900">// buying and downloading a file</span></span>
<span style="color: #000000">00019:</span> <span style="font-weight: bold"><span style="color: #0000FF">try</span></span> <span style="color: #FF0000">{</span>
<span style="color: #000000">00020:</span> client<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">loginUser</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"your_login"</span><span style="color: #990000">,</span> <span style="color: #FF0000">"your_password"</span><span style="color: #990000">);</span>
<span style="color: #000000">00021:</span> <span style="color: #008080">JSONObject</span> res <span style="color: #990000">=</span> client<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">getMedia</span></span><span style="color: #990000">(</span><span style="color: #993399">35957426</span><span style="color: #990000">,</span> <span style="color: #FF0000">"XS"</span><span style="color: #990000">);</span>
<span style="color: #000000">00022:</span> client<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">downloadMedia</span></span><span style="color: #990000">((</span>String<span style="color: #990000">)</span> res<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">get</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"url"</span><span style="color: #990000">),</span> <span style="color: #FF0000">"/tmp/"</span> <span style="color: #990000">+</span> <span style="color: #990000">(</span>String<span style="color: #990000">)</span> res<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">get</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"name"</span><span style="color: #990000">));</span>
<span style="color: #000000">00023:</span> <span style="color: #FF0000">}</span> <span style="font-weight: bold"><span style="color: #0000FF">catch</span></span> <span style="color: #990000">(</span><span style="color: #008080">Exception</span> e<span style="color: #990000">)</span> <span style="color: #FF0000">{</span>
<span style="color: #000000">00024:</span> e<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">printStackTrace</span></span><span style="color: #990000">();</span>
<span style="color: #000000">00025:</span> <span style="color: #FF0000">}</span>
<span style="color: #000000">00026:</span> <span style="color: #FF0000">}</span>
<span style="color: #000000">00027:</span> <span style="color: #FF0000">}</span></tt></pre></div></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_informations">Informations</h2>
<div class="sectionbody">
<div class="paragraph"><p>Email: <a href="mailto:[email protected]">[email protected]</a></p></div>
<div class="paragraph"><p><a href="http://groups.google.com/group/FotoliaAPI?pli=1">Google Groups</a></p></div>
<div class="paragraph"><p><a href="http://us.fotolia.com/Services/API/Rest/Documentation">Online Documentation</a></p></div>
</div>
</div>
</div>
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
Last updated 2012-02-02 10:53:47 CET
</div>
</div>
</body>
</html>