MW API DOCUMENTATION

Terminology:

  • MW: the short name of MagicWeaver

  • CP: the short name of Client Partner who is a business client of MagicWeaver

  • MW-X-SECRET: A long secret/password string, provided by MW. It is shared by MW and CP for authenticating sign-in and sign-up requests and passing user information from CP sides to MW with encryption.

  • JWT: an encrypted token generate with jwt module of Python or other software with same algorithm

  • MW-JWT: is generated by MW server, used for authenticating service access and identifying user

  • MW-X-JWT: is generated by MW server or/and CP server with exactly same algorithm and secret key string. MW and CP use it for identifying each other for data and information exchange. For example, MW uses it to identify a CP and authenticate service access.

  • CP-JWT: is generated by CP server, used for authenticating their service access and identifying user account

post
Sign up

API_END_POINT/sign_up/<partner>/
This endpoint allows you to get free cakes.
Request
Response
Request
Path Parameters
partner
required
string
partner short name e.g. 'MW'
Body Parameters
json
required
string
{"email" : “xxx@xxx.xxx”, ”password”: “xxxxxxxxxx”}
Response
200: OK
Signed up successfully.
{
“status”: 200,
“msg”: “successfully signed up”,
}

post
Sign in

API_END_POINT/sign_in/<partner>
Request
Response
Request
Path Parameters
partner
required
string
partner short name e.g. 'MW'
Body Parameters
json
required
string
{"email": "xxx@xxx.xxx", "password": "xxxxxxxxxx"}
Response
200: OK
{
"msg": "successfully signed in",
"status": 200
}

post
Reset Password

API_END_POINT/request_reset_passwd/<partner>/
Request
Response
Request
Path Parameters
partner
required
string
partner short name e.g. 'MW'
Body Parameters
json
required
string
{"email": "useremail@xxx.com"}
Response
200: OK
{
“status”: 200,
“msg”: “A reset password email has been sent to your email:
useremail@xxx.com”,
}

post
Create Profile

API_END_POINT/create_profile/
Request
Response
Request
Headers
"mw-jwt"
required
string
"MW-JWT string" obtained when sign in
Body Parameters
json
required
string
{ "profile": { "front_gyro_z": 0, "gender": "m", "unit": "cm/kg", "meta": { "app_version": "2.9.92-dev", "app_os": "android", "app_os_version": "9", "front": { "focal_length": 4.3, "focal_length_35mm": 26, "rotation": [ 90.91763305664062, 90.97338104248047 ], "aperture": 1.16, "camera_name": "SM-G960U", "resolution": [ 2880, 2160 ] }, "side": { "focal_length": 4.3, "focal_length_35mm": 26, "rotation": [ 90.31617736816406, 92.4752197265625 ], "aperture": 1.16, "camera_name": "SM-G960U", "resolution": [ 2880, 2160 ] } }, "side_photo": (str) Side photo png base64 stream, "name": "delete me pls", "reference": "letter", "side_gyro_x": 0, "fit": "regular", "side_gyro_y": 0, "side_gyro_z": 0, "front_photo": (str) Front photo png base64 stream, "front_gyro_x": 0, "height_guess": 1.73, "front_gyro_y": 0, "weight_guess": 80 }
Response
200: OK
{
"msg": "successfully created a profile",
"status": 200
}

post
Delete profile

API_END_POINT/delete_profile_by_id/<profile_id>/
Request
Response
Request
Path Parameters
profile_id
required
string
Headers
mw-jwt
required
string
MW_JWT string(obtained when sign in)
Response
200: OK
{
"msg": "successfully deleted profile",
"status": 200
}

post
Update profile

API_END_POINT/update_profile/<profile_id>
Request
Response
Request
Path Parameters
profile_id
required
string
Headers
mw-jwt
required
string
MW_JWT string(obtained when sign in)
Body Parameters
json
optional
string
{ "profile":{ "name": (str) Name of new measurement profile "gender": (str) Gender ("m" | "f") “unit”: (str) ("cm/kg” | “ft-in/lb"), "height_guess": (float) Height in meter | foot inches, e.g. 1.79 m | 5'-10'' "weight_guess": (float) Weight in kg | pound, e.g. 80 kg | 176.6 lb } }
Response
200: OK
{"status": 200,
"profile_info": current profile dict,
}

post
Update measurements

API_END_POINT/update_measurements/<profile_id>/
Request
Response
Request
Path Parameters
profile_id
optional
string
Headers
mw-jwt
optional
string
MW_JWT string(obtained when sign in)
Body Parameters
json
optional
string
{ "profile": { "measurements": { key-value pairs of body part names and raw measurement values arm: 55, hip: 90, chest: 93, ... } } }
Response
200: OK

get
Show 3D Model

API_END_POINTshow_3d_models_in_js_viewer_by_profile_id/<profile_id>/
Request
Response
Request
Path Parameters
profile_id
required
string
Headers
mw-jwt
optional
string
MW_JWT string(obtained when sign in)
Response
200: OK
redirect url response

post
Ger Profile Measurements

API_END_POINT/get_measurements_by_profile_id/<profile_id>/
Request
Response
Request
Path Parameters
profile_id
required
string
Headers
mw-jwt
required
string
MW_JWT string(obtained when sign in)
Body Parameters
json
required
string
{ "parts": [], # names of body parts to calculate measurement for }
Response
200: OK
{
"measurements": {
"arm_length": 0.643,
"back_shoulder": 0.478,
"bicep": 0.444,
"chest": 1.088,
"height": 1.796,
"hip": 1.091,
"knee": 0.445,
"neck": 0.434,
"pants_outseam": 0.99,
"stomach": 0.992,
"waist": 1.036
},
"status": 200
}

get
List Profile

API_END_POINT/list_profiles/app_list/<sort_method>/
Request
Response
Request
Path Parameters
sort_method
required
string
"time" or "name" or "process_status"
Headers
mw-jwt
required
string
MW_JWT string(obtained when sign in)
Response
200: OK
{
"profiles": [
{
"comments": "",
"complete_time": [
"2018-12-12",
"14:36:56"
],
"photos": {
"front_photo_small": front_photo_url,
"side_photo_small": side_photo_url,
},
"process_status": true | false,
"profile_id": "profile_2018-12-10_T_12-32-47",
"profile_name": "test",
"profile_process_status": "MW_COMPLETE" | "MW_FAILED"
"MW_INPROGRESS"|
}
],
“status”: 200
}