我如何让客户端将JSON请求发送给以下代码段?

时间:2019-03-05 19:51:40

标签: json

这是API

/注册

用于将新用户注册到系统中

请求:

{
    "username" : "your_username",
    "password" : "hashed_password", // Hashing happens on client side
    "email" : "your_email"
}

响应:

if(successful){
    "status" : "Success",
    "id" : "identification_number"
}else{
    "status" : "Error",
    "details" : "reason" // ex: Missing param username
}

/ auth

用于向系统验证用户身份

请求:

{
    // Accepted methods: id_only, username_only,email_only
    "method" : "authorization_method"
    "identity" : "id/username/email"  // Based on method attribute
    "password" : "hashed_password"
}

响应:

if(successful){
    "status" : "Granted"
}else{
    "status" : "Error",
    "details" : "reason" // ex: Incorrect Details
}

0 个答案:

没有答案