PUT,POST | /register |
---|
import Foundation
import ServiceStack
/**
* Sign Up
*/
// @Api(Description="Sign Up")
// @DataContract
public class Register : IPost, IMeta, Codable
{
// @DataMember(Order=1)
public var userName:String
// @DataMember(Order=2)
public var firstName:String
// @DataMember(Order=3)
public var lastName:String
// @DataMember(Order=4)
public var displayName:String
// @DataMember(Order=5)
public var email:String
// @DataMember(Order=6)
public var password:String
// @DataMember(Order=7)
public var confirmPassword:String
// @DataMember(Order=8)
public var autoLogin:Bool?
// @DataMember(Order=10)
public var errorView:String
// @DataMember(Order=11)
public var meta:[String:String] = [:]
required public init(){}
}
// @DataContract
public class RegisterResponse : IMeta, IHasSessionId, IHasBearerToken, Codable
{
// @DataMember(Order=1)
public var userId:String
// @DataMember(Order=2)
public var sessionId:String
// @DataMember(Order=3)
public var userName:String
// @DataMember(Order=4)
public var referrerUrl:String
// @DataMember(Order=5)
public var bearerToken:String
// @DataMember(Order=6)
public var refreshToken:String
// @DataMember(Order=7)
public var refreshTokenExpiry:Date?
// @DataMember(Order=8)
public var roles:[String] = []
// @DataMember(Order=9)
public var permissions:[String] = []
// @DataMember(Order=10)
public var responseStatus:ResponseStatus
// @DataMember(Order=11)
public var meta:[String:String] = [:]
required public init(){}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /register HTTP/1.1
Host: vue-vite-api.jamstacks.net
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
userName: String,
firstName: String,
lastName: String,
displayName: String,
email: String,
password: String,
confirmPassword: String,
autoLogin: False,
errorView: String,
meta:
{
String: String
}
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { userId: String, sessionId: String, userName: String, referrerUrl: String, bearerToken: String, refreshToken: String, refreshTokenExpiry: 0001-01-01, roles: [ String ], permissions: [ String ], responseStatus: { errorCode: String, message: String, stackTrace: String, errors: [ { errorCode: String, fieldName: String, message: String, meta: { String: String } } ], meta: { String: String } }, meta: { String: String } }