assistance-engine/docs/developer.avapframework.com/10_get_signature_get_signat...

3.5 KiB

This service is used to get the sign of a informed string

GET: URL_BASE + /ws/util.py/get_signature

Receives:

The string to be signed and the private key to sign the string

Returns:

Depending on the result of the operation, this service can return two different JSON:

Answer JSON OK:

{
         "status": true,  "signature":
        "38779748c3bb130d0d1f8084ad92607d705e88b7", "elapsed":
        0.002902984619140625
        
        }

Where:

  • status: Shows if the call has been successful (true) or not (false).
  • signature: The signature calculated from the string{' '}
  • elapsed: Operation execution time.

Answer JSON KO:

{
         "status"
        :{' '}
        false
        ,
         "nivel"
        : <string>
        ,
         "message"
        : <string>
        ,
         "error"
        : <string>
         }

Where:

  • status: Shows if the call has been successful (true) or not (false).
  • nivel: Error importance level.
  • message: Error message.
  • error: Sole error code.

Example requests:

Python - Requests:

import requests
        
        url ={' '}
        
          "http://api.staging.pademobile.com:8000/ws/util.py/get_signature?string_to_sign=codigo_pais%3DMX%26id_usuario%3D2%26telefono%3Doperabills%26importe%3D30000%26referencia%3DFondeo&private_key=3SQb94TOcHCm"
        
        
        payload=
        {
        }
        
        headers ={' '}
        {
         '101ObexApiKey'
        :{' '}
        'ri1JlbIJ7oO2kobKNwEdXrZDhd4PoZd8'
        
        }
        
        response = requests
        .request
        (
        "GET"
        , url
        , headers
        =headers
        , data
        =payload
        )
        
        print
        (response
        .text
        )

NodeJs - Request:

var request = require('request');
        
        var options = {
         'method': 'GET',
         'url':
        'http://api.staging.pademobile.com:8000/ws/util.py/get_signature?string_to_sign=codigo_pais%3DMX%26id_usuario%3D2%26telefono%3Doperabills%26importe%3D30000%26referencia%3DFondeo&private_key=3SQb94TOcHCm',
         'headers': {
         '101ObexApiKey': 'ri1JlbIJ7oO2kobKNwEdXrZDhd4PoZd8'
         }
        
        };
        
        request(options, function (error, response) {
         if (error) throw new Error(error);
         console.log(response.body);
        
        });

JavaScript - Fetch:

var myHeaders = new Headers();
        
        myHeaders.append("101ObexApiKey",
        "ri1JlbIJ7oO2kobKNwEdXrZDhd4PoZd8");
        
        var requestOptions = {
         method: 'GET',
         headers: myHeaders,
         redirect: 'follow'
        
        };
        
        fetch("http://api.staging.pademobile.com:8000/ws/util.py/get_signature?string_to_sign=codigo_pais%3DMX%26id_usuario%3D2%26telefono%3Doperabills%26importe%3D30000%26referencia%3DFondeo&private_key=3SQb94TOcHCm",
        requestOptions)
         .then(response => response.text())
         .then(result => console.log(result))
         .catch(error => console.log('error', error));

CURL:

curl --location --request GET{' '}
        
          'http://api.staging.pademobile.com:8000/ws/util.py/get_signature?string_to_sign=codigo_pais%3DMX%26id_usuario%3D2%26telefono%3Doperabills%26importe%3D30000%26referencia%3DFondeo&private_key=3SQb94TOcHCm'
        {' '}
        \

Business logic:

With this endpoint it is allowed to calculate the sign from a strign using a private key.