RestClient

How to implement this in delphi using FNC RestClient ?

#Python

import requests
import json
import sys
import hashlib

prot = 'http'
host = '192.168.1.1'
user = '0011'
pw = 'starface'

url = prot + '://' + host + '/rest/login'

templateResponse = requests.get(url, headers={'Content-Type':'application/json', 'X-Version':'2'}, verify=False)
templateJson = json.loads(templateResponse.content)
#print(templateResponse.text)
userandnonce=(user+templateJson['nonce']).encode(encoding='utf_8', errors='strict')
hpassword=hashlib.sha512(pw.encode(encoding='utf_8', errors='strict')).hexdigest()
passwordHashed=hpassword.encode(encoding='utf_8')
hsecret = hashlib.sha512(userandnonce+passwordHashed).hexdigest().encode(encoding='utf_8')
#print 'secret: ' + hsecret

secretCompound=user+':'+hsecret.decode(encoding='utf_8')
templateJson['secret'] = secretCompound
#print templateJson
authTokenResponse = requests.post(url, data=json.dumps(templateJson), headers={'Content-Type':'application/json', 'X-Version':'2'}, verify=False)

authtoken = json.loads(authTokenResponse.content)['token']

You can build this request with the body, headers and the url with the TTMSFNCRESTClient.

But the TMS FNC Cloud Pack doesn't have the SHA-2 encryption.
This can be done with our TMS Cryptography Pack