Skip to content

Instantly share code, notes, and snippets.

@Khang-NT
Last active March 23, 2019 03:40
Show Gist options
  • Save Khang-NT/7dcaf646eb82a776d908d20b35b672b1 to your computer and use it in GitHub Desktop.
Save Khang-NT/7dcaf646eb82a776d908d20b35b672b1 to your computer and use it in GitHub Desktop.
Example response of update app detail api

Every time update app detail, server will validate ALL app detail data again. If app is published and validation fail, reject this api and DON'T change database. If app not yet published, maybe accept this api and save change to database.

Example update title, response has some warnings

Update body

{
  "detail": {
    "en": {
      "title": "Hello"
    }
  }
}
{
  "code": 200000,
  "message": "OK",
  "payload": {
    "validationError": {
      "categoryId": "Missing category",
      "supportEmail": "Missing supportEmail",
      "detail": {
        "en": {
          "shortDesc": "Short description too long"
        }
      }
    }
  }
}

Example update invalid data, api rejected regardless "publish" or "unpublished"

Update body:

{
  "categoryId": "blas...xyz...invalid"
}

Response:

{
  "code": 400000,
  "message": "Invalid param",
  "payload": {
    "categoryId": "Invalid category"
  }
}

App detail validate:

- categoryId in Constants.CATEGORY_IDS (stricky)
- count(!version.removed && rollOutPercent >= 1) > 0 
- detail.size MUST > 0 (stricky)
- detail.title length in range [10, 50]
- detail.shortDesc length in range [10, 80]
- detail.fullDesc length in range [100, 4000]
- detail.screenshots.size > 0
- detail.highResIcon != null
- detail.featureGraphic != null
- supportEmail valid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment