Authentication

The Sketch2Model API has no form of authentication required at the moment, so please be nice and rate limit your requests to something reasonable.

Heartbeat API

Query the heartbeat to check if the Sketch2Model API is currently up and running.

http://www.sketch2model.com/api/heartbeat

    Parameters
    None

    Response
    ok - success returns True, failure returns False
    error - success returns "", failure returns error details
    
    Example Query - Python
    import requests

    r = requests.get("http://www.sketch2model.com/api/heartbeat")

    r.status_code
    >> 200

    r.json()
    >> {'ok': True, 'error': ''}
    

Main Sketch2Model API

This is the primary image processing workhorse behind Sketch2Model. Given an input image it will run the server side scikit-image image processing code and return a the url of a model image hosted on s3. Please note that images are only hosted temporarily.

http://www.sketch2model.com/api

    Parameters
    url - input image url
    contrast - contrast parameter value 0.1 to 0.9
    closing - closing parameter value 1 to 5
    cmap - matplotlib colormap from one of the following:
           viridis, inferno, plasma, magma, Accent, Dark2, Paired,
           Pastel1, Pastel2, Set1, Set2, Set3. See matplotlib docs.

    Response
    ok - success returns True, failure returns False
    url - success returns hosted model url, failure returns ""
    error - success returns "", failure returns some error details
    
    Example Query - Python
    import requests

    url = "https://s3-us-west-2.amazonaws.com/sketch2model/examples/Simple.png"
    contrast = "0.5"
    closing = "3"
    cmap = "Pastel2"

    payload = {
    "url": url,
    "contrast": contrast,
    "closing": closing,
    "cmap": cmap
    }

    headers = {"Accept": "application/json"}

    r = requests.get("http://www.sketch2model.com/api",
    headers=headers,
    params=payload)

    r.status_code
    >> 200

    r.json()
    >> {'ok': True, 'error': '', url:'output_url_string'}