0

How do I return an image from an apiary call?

## first image [/image/369]
### Complete [GET]
+ Response 200 (image/png)
xxxxxxxx
Greg Pagendam-Turner
  • 2,356
  • 5
  • 32
  • 49

1 Answers1

0

Turner, here is the declaration code in apiari for this method :

## first image [/image/369]
### Complete [GET]
+ Response 200 (image/png)

    + Body
    ‰PNG XXXXXXXXXXXXFZFZGEDHDSRGFEThERGEDFG

Enjoy :)

jeorfevre
  • 2,286
  • 1
  • 17
  • 27
  • What should XXXXXX image XXXXXX be? Should it be base64 encoding of binary that is then escaped for markdown? – Greg Pagendam-Turner Jun 07 '14 at 23:48
  • you're right it's the image file returned, see my modified post – jeorfevre Jun 08 '14 at 00:21
  • it's the content of the image file that would be in the body (take care of apiary requierement with indentation ! :) – jeorfevre Jun 08 '14 at 00:27
  • How do I encode a binary image into text in apiary? – Greg Pagendam-Turner Jun 08 '14 at 01:20
  • 1
    ok, I see you should encode in [ANSI ISO-8859](http://en.wikipedia.org/wiki/ANSI_character_set). But apiari isn't a code generator, it's oriented to produce geek docs. – jeorfevre Jun 08 '14 at 02:03
  • normaly in order to add images, you should return the uri of the image and then make a frontend call to the image uri. You shouldn't pass the image stream thrue your webserver, it will cost a lot of time/cpu. That is precious. see [apiary movie](http://docs.themoviedb.apiary.io/#movies) and search for image, you will see that the returned element of your api is an uri. Give me some feedback. enjoy :) – jeorfevre Jun 08 '14 at 14:42