POST(HTTP)
http://ai.measuresquare.com/api/file
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
- pixellength: scale, represents the length in fact of each pixel (by millimeter)
 
- file: floorplan file
 
- Json object,include two field, 
rooms and doors 
rooms: a list of room object, each room have two field (id and points) 
doors: a list of door object, The structure is the same as rooms 
points: a list of point object, each point have two integer field x,y 
data example
     {
        rooms:[
            {
                id: 1,
                points: [
                    { x:x1, y:y1}, { x:x2, y:y2}, ...
                ]
            },
            {
                id: 2,
                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} ]
            },
            ...
        ]
    }
data = {'PixelLength':4}
files = {'file': open(filepath, 'rb')}
response = requests.post(url, data=data, files=files, auth=HTTPBasicAuth('user', 'pass'))