API Documentation

Method

POST(HTTP)

Request Url

Return Floor Plan : http://ai.measuresquare.com/api/file

Return Outline: http://ai.measuresquare.com/api/outline

Authentication

Use HTTP Basic auth.

We will provide a string format of user:pass.

BASE64 encode the string.

Supply an Authorization header with content Basic followed by the encoded string.

For example:

The string 'user:pass' encodes to 'dXNlciUzQXBhc3M='
So that we should add "Authorization: Basic dXNlciUzQXBhc3M=" to request header

Parameters

Return

Json object,include 4 field:

points: a list of point object, each point have two
integer field x,y

return data example:

     {
        area: xxxxx,
        perimeter: yyyyy,
        rooms:[
            {
                id: 1,
                area: 11,
                perimeter: 22,
                points: [
                    { x:x1, y:y1}, { x:x2, y:y2}, ...
                ]
            },
            {
                id: 2,
                area: 33,
                perimeter: 44,
                points: [
                    { x:x1, y:y1}, { x:x2, y:y2}, ...
                ]
            }
            ...
        ],
        doors:[
            {
                id: 1,
                points: [  { x:x1, y:y1}, { x:x2, y:y2} ]
            },
            {
                id: 2,
                points: [  { x:x1, y:y1}, { x:x2, y:y2} ]
            },
            ...
        ]
    }

Python example

import urllib2
url = 'http://ai.measuresquare.com/api/file'
data = {'PixelLength':4}
files = {'file':open(filepath, 'rb')}
response = requests.post(url, data=data, files=files,
auth=HTTPBasicAuth('user', 'pass'))

download python code by click here