Skip to content

EXAMPLE REQUESTS AND RESULT SETS

1. Javascript Pseudocode

Authentication with api_key & api_secret (retrieved from Authentication 365 UI)

 function request() {
  var http;
  var url = "https://authentication.sapdigitalinterconnect.com/oauth/token"
      http = new XMLHttpRequest();

  http.onreadystatechange = function() {
    if (http.readyState == 4 && http.status == 200) {
      console.log(http.responseText);
    }
  }

  http.open("POST", url ,true);
  http.setRequestHeader("Authorization", "Basic MXlzYk1vanNoYnJQQktvYTpaeFFVazQzTXJrZUV5QTQyekZYZG1mbVlXSDVoT1RReQ==")
  http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") 
  http.send("grant_type=client_credentials");
}
// calling function will give this results
Response:
{
    "access_token": "Wuh3Lm4SWRyuqsmCRModQ1BQDfI7bnk0",
    "token_type": "Bearer",
    "expires_in": 2586127,
    "refresh_token": "OExdRmIKVqvklpD8",
    "refresh_expires_in": 4086127,
    "scope": "MyScope"
}

Generate PIN

function request() {
  var http;
  var url = "https://authentication.sapdigitalinterconnect.com/tokens/generate"
      http = new XMLHttpRequest();

  http.onreadystatechange = function() {
    if (http.readyState == 4 && http.status == 200) {
      console.log(http.responseText);
    }
  }

  http.open("POST", url ,true);
  http.setRequestHeader("Content-Type", "application/json")
  http.setRequestHeader("Authorization", "Bearer 5c176714-4bf6-47a3-9ed5-5b37e0957e0c")
  http.send('{
    "accountId": 550055,
    "telephoneNumber": "+14449092312",
    "secondaryKey": "123",
    "messageBody": "Hi, your token is [token]",
    "characterSet": "",
    "tokenLength": 6,
    "pinType": 1,
    "timeOut": 180 
  } ')
}
// calling function will give this results
Response:
{
    "status":"success",
    "message":" Hi, your token is ad142yW",
    "orderID":"1000084257"
}

Generate 2 Part PIN

function request() {
  var http;
  var url = "https://authentication.sapdigitalinterconnect.com/tokens/generate"
      http = new XMLHttpRequest();

  http.onreadystatechange = function() {
    if (http.readyState == 4 && http.status == 200) {
      console.log(http.responseText);
    }
  }

  http.open("POST", url ,true);
  http.setRequestHeader("Content-Type", "application/json")
  http.setRequestHeader("Authorization", "Bearer 5c176714-4bf6-47a3-9ed5-5b37e0957e0c")
  http.setRequestHeader("2-Part", "true")
  http.send('{
    "accountId": 550055,
    "telephoneNumber": "+14449092312",
    "secondaryKey": "123",
    "messageBody": "Hi, your token is [token]",
    "characterSet": "",
    "tokenLength": 6,
    "pinType": 1,
    "timeOut": 180
   } ');
}

// calling function will give this results
Response:
{
    "status":"success",
    "message":" Hi, your token is ad142yW",
    "orderID":"1000084257", 
    "part2Token":"EDYB"
 }

Generate PIN by generic Key endpoint

function request() {
  var http;
  var url = "https://authentication.sapdigitalinterconnect.com/tokens/generateByKey"
      http = new XMLHttpRequest();

  http.onreadystatechange = function() {
    if (http.readyState == 4 && http.status == 200) {
      console.log(http.responseText);
    }
  }

  http.open("POST", url ,true);
  http.setRequestHeader("Content-Type", "application/json")
  http.setRequestHeader("Authorization", "Bearer 5c176714-4bf6-47a3-9ed5-5b37e0957e0c")
  http.send('{
    "accountId": 550055,
    "key": "211B, Baker Street",
    “secondaryKey”: “123”,
    "messageBody": "Hi, your token is [token]",
    "characterSet": "",
    "tokenLength": 6,
    "pinType": 1,
    "timeOut": 180
   } ');
}

// calling function will give this results
Response:
{
    "status":"success",
    "message":" Hi, your token is ad142yW",
    "orderID":"1000084257"
 }

Generate PIN using E-Mail Address

function request() {
  var http;
  var url = "https://authentication.sapdigitalinterconnect.com/tokens/generate"
      http = new XMLHttpRequest();

  http.onreadystatechange = function() {
    if (http.readyState == 4 && http.status == 200) {
      console.log(http.responseText);
    }
  }

  http.open("POST", url ,true);
  http.setRequestHeader("Content-Type", "application/json")
  http.setRequestHeader("Authorization", "Bearer 5c176714-4bf6-47a3-9ed5-5b37e0957e0c")
  http.send('{
  "accountId": 550055,
  "emailAddress": "xyz.abc@Sinch.com,
  messageBody: Hi, your token is [token],
  characterSet: “”,
  tokenLength: 6,
  pinType: 1,
  timeOut: 180
   } );
}

// calling function will give this results
Response:
{
    status:success,
    message: Hi, your token is ad142yW,
    orderID:1000084257
}

URL Authorization

function request() {
  var http;
  var url = "https://authentication.sapdigitalinterconnect.com/tokens/urlAuthorization"
      http = new XMLHttpRequest();

  http.onreadystatechange = function() {
    if (http.readyState == 4 && http.status == 200) {
      console.log(http.responseText);
    }
  }

  http.open("POST", url ,true);
  http.setRequestHeader("Content-Type", "application/json")
  http.setRequestHeader("Authorization", "Bearer 5c176714-4bf6-47a3-9ed5-5b37e0957e0c")
  http.send('{
  "accountId": 550055,
  "telephoneNumber": "+14449092312",
  "successmsg": "You have been authorized.",
  "characterSet": "",
  "timeOut": 180
   } ');
}

// calling function will give this results
Response:
{
"status":"success",
"message":" Hi, your token is ad142yW",
"orderID":"1000084257"
}

Validate PIN

function request() {
  var http;
  var url = "https://authentication.sapdigitalinterconnect.com/tokens/validate"
      http = new XMLHttpRequest();

  http.onreadystatechange = function() {
    if (http.readyState == 4 && http.status == 200) {
      console.log(http.responseText);
    }
  }

  http.open(POST, url ,true);
  http.setRequestHeader(Content-Type, application/json)
  http.setRequestHeader(Authorization, Bearer 5c176714-4bf6-47ª3-9ed5-5b37e0957e0c)
  http.send( {accountId:550055,telephoneNumber:+14449092312,"oneTimePassword":"ad142yW" , secondaryKey : 123} ');
}
// calling function will give this results
Response:
{
    "status":"success",
    "messageBody": null
}