Xpace Auth Documents

Authorization

Authorization is using JWT token created after clients have successfully logged in. Token must be sent with request headers when it's required by reading and writing settings you set in your account control panel.

  • URL

              https://api.xbuffer.net/client/<user_name>/<project_name>/
            
  • Usage:

    Token must be added to the header part of your request.
    You don't have to use the token in "open" reading or writing settings for your database or storage.

    ...
    'Authorization': 'Bearer < ... token goes here ... >'
    ...
  • Required Params:

    • 'Authorization': in header part is where you add the token you recieved after the login.

    headers: { ... 
    'Authorization': 'Bearer eyJh...CJ9.eyJ...3fQ==.76T...8nc='
    'Content-Type': 'application/json'
    ... }

Signup

To use some restricted parts of data or media, you need authentication to preceed. You let your client signup to your project using registration form with email and password as mandatory feilds. More optional parameters and signup options will be added soon.

  • URL

              https://api.xbuffer.net/client/<..user_name..>/<..project_name..>/signup
            
  • Methods & Params

    This method is to let your client signup to your project using registration form with email and password as mandatory feilds. More optional parameters and signup options will be added soon.

    Request Method:

    POST

    Required Params:

    • appid key must be presented to access your data. Each project has it's own unique id for different platforms such as "web", "iOS", etc... You must provide the platform key after the appid by seperate them by a colon (:). You can get the appid from your account's control panel. You can reset one or all keys but you have to update your requests by the new generated keys.
    • email key must be provided in a right email format.
    • password key must be provided with minimum of 6 charachters.

    headers: { ... 
    'Content-Type': 'application/json'
    ... }

    body: { ...
    appid=[string:string]
    email=[string]
    password=[string]
    ... }

    Optional Params:

    no optional params so far

  • Success Response:

    If the request was accepted and the process went well, you'll be getting a unique ID for the signed up user.

    • Response Code: 200
      Content:
      { 
      "success": true
      "data": {
      "Affected-ID: ...."
      }
      }
  • Error Response:

    In case of error response, you'll get a response error code, internal error code and a message explianing the error type.

    • Response Code: 400, 401 or 406
      Content:
      { 
      "success": false
      "data": {
      "Code: [XBGRL0000]"
      "Message: ...."
      }
      }
  • JavaScript Example using jQuery :

    function send() {
      var url = "https://api.xbuffer.net/client/<..user_name..>/<..project_name..>/signup"
      var parameters = {
        appid: 'abs23...3cb:web',
        email: $("#id-email").val(),
        password: $("#id-password").val(),
      }
    
      $.ajax({
        url: url,
        type: 'post',
        dataType: 'json',
        success: function (data) {
          console.log('success')
        },
        data: parameters
      });
    }
            
  • iOS Example using Almofire :

    let url = "https://api.xbuffer.net/client/<..user_name..>/<..project_name..>/signup"
    let parameters: Parameters = [
      "appid": "abs23...3cb:apple",
      "email": "example@domain.com",
      "password": "password here"
    ]
    Alamofire.request(url, method: .post, parameters: parameters, encoding: JSONEncoding.default)
            
  • Android Example:

              ... soon ...