HTML5 Animation to GIF - API

  • Introduction

  • This document covers API detail and instruction to make a animated GIF from html5 animation. Following are basic steps:
    1. 1. Uploading of your HTML5 creative as zip or url for creating gif.
    2. 2. A call to make gif with parameters like height, width, duration etc.
    3. 3. Webhook information to get downloadable url once gif gets created.
    4. 4. A pinging service to wait for output gif and it's progess.
  • Method: Uploadzip

  • Description:

    This service is used to upload zip file of HTML5 creative. Zip file should contain one html file along with its dependent resources like ( css, javascript and images). This service returns “creativeid” in the response which is used in subsequent service call. Please Note: If you want to generate gif from http url (instead of a zip file) then do not use this service and move to next service ‘UploadUrl’.

  •                                     Service url: https://html5animationtogif.com/api/uploadzip.ashx 
                                    
  • Request Body Parameters

  • Paramter Description Type
    FileData Post your zip file as multi part form data. Muitipart form data
  • Response Body Parameters

  • Paramter Description Type
    status Status of the execution. Possible values are “success” and “error”. string
    creativeid Unique Id of uploaded zip. This is a reference id. It has to be used in the subsequent service “converttogif.ashx”. string
    message Error message (if any) string
  • Success response example

  •                                      { "status": "success",  "creativeid": "creative_550x550_10ed7e8783" }
                                    
  • Error response example

  •                                      { "status": " error ",  "message” ": "No file has been uploaded. " }
                                    
  • Method: UploadUrl

  • Description:

    This service is used to post "http url" of your HTML5 creative. Service returns “creativeid” in response which is used in subsequent service.
    Note: If you are uploading zip file of your html5 creative then please do not use this service and refer "UploadZip" service.

  •                                     Service url: https://html5animationtogif.com/api/uploadurl.ashx 
                                    
  • Request Body Parameters

  • Paramter Description Type
    url http url of your creative String
  • Response Body Parameters

  • Paramter Description Type
    status Status of the execution. Possible values are “success” and “error”. string
    creativeid Id of uploaded zip creative. This is a reference id. It has to be passed in the next service “converttogif.ashx”. string
    message Error message (if any) string
  • Success response example

  •                                     { "status": "success",  "creativeid": "creative_550x550_10ed7e8783" }
                                    
  • Error response example

  •                                     { "status": " error ",  "message” ": "No file has been uploaded. " }
                                    
  • Method: ConvertToGif

  • Description:

    This service converts your html5 creative into the Gif. This service initiates rendering call asynchronously.

  •                                     Service url: https://html5animationtogif.com/api/converttogif.ashx  
                                    
  • Request Body Parameters

  • Paramter Description Type
    clientid Id of the customer. It is provided at the time of registration or through email. string
    apikey A unique key to access API. It is provided at the time of registration or through email. string
    creativeid Id of uploaded creative. It is returned in response of "uploadzip" or "uploadurl" service call. string
    height Height of the creative. number
    width Width of the creative. number
    duration Duration of the creative. (or duration of a loop) number
    loop Loop for GIF. For "forever" loop, pass value as loop=0. Possible values are 0 to 1000. Please Note: If your animation has more than one loop then you should provide "duration" of one loop, not the total duration including all loop count. number
    fps Frames per second. Minimum value is 2 and Maximum 30. number
    webhookurl Default value is “” (i.e webhookurl="") Webhook is notification to your application once gif gets ready. Your application has to pass an http url of application. Once gif gets ready,
    Following parameters will be posted to the webhook url:
    1. downloadurl
    2. mediaid
    3. creativeid
    For example, you can access in your application as follows var url = Request[“downloadurl”];
    downloadurl: A download url of the gif.
    mediaid: Id of gif in our system.
    creativeId: Unique id which was created based on your uploaded file/url
    fileext (extension of the file i.e mp4 or gif)
    string
    creativefitoption This option specifies, how does creative gest positioned in the browser. Possible values are “lefttop” and “center”. Default value is “lefttop” string
    quality This option specifies about quality of GIF.
    Possible values are: 0,1,2,3 or 4 Default value is 3 (i.e 75% quality)
    Pass one of above value on the request and these values are equivalent to 15%,25%,50%,75%or 100%
    string
    maxsize Specifies target file size of gif in KB. For example 150 or 80 etc (i.e. maxsize=150) This is an optional parameter and default value is 0. Maximum supported value is 10000 kb and minimum 20 kb Please Notes: To achieve target file size, render tries multiple attempts. Renderer can reduce given FPS and Quality, (if needed). For example: If you want to achieve target file size of 150kb at 5 fps. Render will first make gif as it as, then it will check file size. If file size still above than 150kb, then render will reduce fps and quality to achieve target file size. There could be multiple integrations in this process. number
  • Response Body Parameters

  • Paramter Description Type
    status Status of the execution. Possible values are “success” and “error”. string
    mediaid id for the media. Use this value in the “checkstatus” service to know the status of processing. string
    message Error message (if any) string
  • Success response example

  •                                     { "status": "success",  "message": "",  " mediaid ": "34488" }
                                    
  • Error response example

  •                                     { "status": "error",  "message": "Invalid API key or Client Id" }
                                    
  • Method: Checkstatus

  • Description:

    This service is used to check status of conversion. It should be invoked after the “converttogif” service. This service can be invoked periodically (or interval)
    Please Note: If you are passing 'webhook' url (in the converttogif service) then skip this service. gif url and other information will be posted to webhook url automatically once gif gets created.

  •                                     Service url:  https://html5animationtogif.com/api/checkstatus.ashx 
                                    
  • Request Body Parameters

  • Paramter Description Type
    creativeid id of the creative. String
    mediaid Id of the media. String
    fileext gif String
  • For example

  •                                     https://html5animationtogif.com/api/checkstatus.ashx?
    creativeid=creative_550x550_10ed7e8783&mediaid=34488&fileext=gif
  • Response Body Parameters

  • Paramter Description Type
    status Status of the service call. Possible values are “success” and “error”. string
    jobstatus Status of the processing. string
    message Error message (if any) string
    url Download Url of GIF. string
  • Success response example

  •                                      
    Specifies, scrapping of content 
    { “status”: "success",  "jobstatus": "Scraping content. Please wait...",  "url": "" }
    
    Specifies, encoding of gif
    
    { "status": "success",  "jobstatus": "20%",  "url": "" }
    { "status": "success",  "jobstatus": "40%",  "url": "" }
    { "status": "success",  "jobstatus": "90%",  "url": "" }
    
    Specifies, gif has been created.
    { "status": "success",  "jobstatus": "done",  "url": "https://html5animationtogif.com/API/mediadownload.ashx?mediaid=34488&creativeid=creative_550x550_10ed7e8783&fileext=gif&inline=y" }
                                    
  • Error response example

  •                                     { "status": "error",  "message": "File doesn't exist." }
                                    
  •