assistance-engine/docs/developer.avapframework.com/69_set_set_blockchain_accou...

3.6 KiB

ws/users.py/set_blockchain_accounts

Receives

All the parameters that the service receives must be indicated in the body of the request.

Returns:

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

{
         "status"
        :{' '}
        true
        ,
         "message"
        :{' '}
        
          "BlockChain Account for User 95 Set to 23"
        
        ,
         "codtran"
        :{' '}
        "f856c5db007fcaa5a00b9a4d56a9d40a"
         "elapsed"
        :{' '}
        0.778839111328125
        
        }

Where:

  • status: Shows if the call has been successful (true) or not (false).
  • message : Mensaje de confirmación.
  • codtran : Transaction code.
  • 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).
  • level: Error importance level.
  • message: Error message.
  • error: Sole error code.

Example requests:

Python - Requests:

import requests
        
        
        url ={' '}
        
          "http://34.121.95.179:80/ws/users.py/set_blockchain_accounts?codigo_pais=ES&id_usuario=95&id_sesion=629-M-ofq9Y060u3ja2uqLx1aQ==&account_id=23"
        
        
        
        payload=
        {
        }
        
        headers ={' '}
        {
         '101ObexApiKey'
        :{' '}
        'KcM6Vr7EfNnKScEi00jdritBzNjWAOkz'
        
        }
        
        
        response = requests
        .request
        (
        "GET"
        , url
        , headers
        =headers
        , data
        =payload
        )
        
        
        print
        (response
        .text
        )

NodeJs - Request:

var request = require('request');
        
        var options = {
         'method': 'GET',
         'url':
        'http://34.121.95.179:80/ws/users.py/set_blockchain_accounts?codigo_pais=ES&id_usuario=95&id_sesion=629-M-ofq9Y060u3ja2uqLx1aQ==&network_id=23',
         'headers': {
         '101ObexApiKey': 'KcM6Vr7EfNnKScEi00jdritBzNjWAOkz'
         }
        
        };
        
        request(options, function (error, response) {
         if (error) throw new Error(error);
         console.log(response.body);
        
        });

JavaScript - Fetch:

var myHeaders = new Headers();
        
        myHeaders.append("101ObexApiKey",
        "KcM6Vr7EfNnKScEi00jdritBzNjWAOkz");
        
        
        var requestOptions = {
         method: 'GET',
         headers: myHeaders,
         redirect: 'follow'
        
        };
        
        
        fetch("http://34.121.95.179:80/ws/users.py/set_blockchain_accounts?codigo_pais=ES&id_usuario=95&id_sesion=629-M-ofq9Y060u3ja2uqLx1aQ==&account_id=23",
        requestOptions)
         .then(response => response.text())
         .then(result => console.log(result))
         .catch(error => console.log('error', error));

CURL:

curl --location --request GET{' '}
        
          'http://34.121.95.179:80/ws/users.py/set_blockchain_accounts?codigo_pais=ES&id_usuario=95&id_sesion=629-M-ofq9Y060u3ja2uqLx1aQ==&account_id=23'
        {' '}
        \
        
        --header{' '}
        
          '101ObexApiKey: KcM6Vr7EfNnKScEi00jdritBzNjWAOkz'

Business logic:

This service aims to select one of the user's blokchain accounts as active by default.