Skip to content

User API

uniray7 edited this page Oct 16, 2017 · 1 revision

Create User

Get User

  • it is related to User.remoteMethod('getProfile'

Upload User Photo

  • it is related to User.remoteMethod('uploadProfilePhoto')

Change Password

Request Resetting Password

Handle Resetting Password

[User.remoteMethod('query')]

auth Facebook Token

  • it is related to User.remoteMethod('authFacebookToken'), which will be needed by developers
  • URL: http://$DOMAIN_NAME/api/media/panophoto?access_token=$TOKEN
  • Header: Content-Type=multipart/form-data
  • Body:
    • title: 'test'
    • caption: 'test for panophoto'
    • width: '8192'
    • height: '4096'
    • lat: '30'
    • lng: '90'
    • locationName(optional): 'Home Sweet Home'
    • locationLat(optional): '25.05511'
    • locationLng(optional): '121.61171'
    • thumbnail: '$THUMBNAIL_IMAGE_PATH
    • image: '$SRC_IMAGE_PATH'
  • return:
{ "mediaId": "ab90b0d91414f000" }
  • curl example:
curl -X POST  -H "Content-Type: multipart/form-data" -F "caption='test'" -F "title='ttt'" -F "thumbLat=9.0" -F "thumbLng=10.0" -F "width=5376" -F "height=2688" -F "[email protected];type=image/jpeg" -F "[email protected]" http://$DOMAIN_NAME/api/media/panophoto?access_token=$TOKEN
  • function in src code: Media.remoteMethod('createPanoPhoto')

Read

  • it is related to Media.remoteMethod('findMediaById'), which will be needed by developers
  • URL: http://$DOMAIN_NAME/api/media/$MEDIA_ID
  • Header: Content-Type=application/json
  • Body: No body
  • return:
{
  "result":{
    "sid":"$MEDIA_ID",
    "status":"completed",
    "dimension":{
      "width":5376,
      "height":2688,
      "lat":9,
      "lng":10},
    "type":"panoPhoto",
    "caption":"'test'",
    "created":"2017-03-24T04:24:03.196Z",
    "modified":"2017-03-24T04:24:06.344Z",
    "ownerId":"f38a14f0-0a25-11e7-b4ef-35bf597ca62a",
    "locationId":null,
    "title":"'test title'",
    "tags":[],
    "owner":{
      "sid":"f38a14f0-0a25-11e7-b4ef-35bf597ca62a",
      "username":"ray",
      "identities":[]},
    "content":{
      "shardingKey":"c088",
      "storeUrl":"https://undefined.s3.amazonaws.com/",
      "cdnUrl":"undefined",
      "quality":[{"size":"4000X2000","tiles":8},       
                 {"size":"2000X1000","tiles":2}],
      "project":"equirectangular"}
  }
}
  • curl example:
curl -X GET -H "Content-Type: application/json" http://$DOMAIN_NAME/api/media/$MEDIA_ID

Update

only "title" and "caption" can be update

  • URL: http://$DOMAIN_NAME/api/media/$MEDIA_ID?access_token=$TOKEN
  • Header: Content-Type=application/json
  • Body: note: u only need to add the property u want to update in the body
{"title": "$NEW_TITLE", "caption": "$NEW_CAPTION"}
  • return:
{
  "sid":"ad7f474dbe0f3400",
  "status":"completed",
  "dimension":{
    "width":5376,
    "height":2688,
    "lat":9,
    "lng":10},
  "type":"panoPhoto",
  "content":{
    "shardingKey":"c088",
    "storeUrl":"https://undefined.s3.amazonaws.com/",
    "cdnUrl":"undefined",
    "quality": [{"size":"4000X2000","tiles":8},
                {"size":"2000X1000","tiles":2}],
    "project":"equirectangular"},
  "caption":"'$NEW_CAPTION'",
  "created":"2017-03-24T04:24:03.196Z",
  "modified":"2017-03-24T05:55:51.538Z",
  "ownerId":"f38a14f0-0a25-11e7-b4ef-35bf597ca62a",
  "locationId":null,
  "title":"$NEW_TITLE",
  "tags":[]}
  • curl example:
curl -XPUT -H "Content-Type: application/json" -d '{"title": "$NEW_TITLE", "caption": "$NEW_CAPTION"}' http://$DOMAIN_NAME/api/media/$MEDIA_ID?access_token=$TOKEN

DELETE

  • URL: http://$DOMAIN_NAME/api/media/$MEDIA_ID?access_token=$TOKEN
  • Header: No
  • Body: No
  • return:
{"count":1}
  • curl example:
curl -XDELETE http://$DOMAIN_NAME/api/media/$MEDIA_ID?access_token=$TOKEN