-
-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
POST API to Verint, the connection is not getting authorised #489
Comments
PFB the prerequisite request used in postman" var sdk = require('postman-collection'); //get api key and key id //get ISO date //generate base64url by using cryptojs //convert base64url to base64 //convert to base 64 url return output; var replaceVars = function(string) // get 32 bytes random; //get path expanding any variables that exist //generate canonicalizedHeader for (var key in ref) { //only headers with "verint-" prefix can be used canonicalizedHeader += (key + ":"); canonicalizedHeader += value; //make canonicalizedHeader it lower case //get String to sign var stringToSign = salt + "\n" + method + "\n" + path + "\n" + issuedAt + var hash = crypto.HmacSHA256(stringToSign, //get an signature //String prefix //Generate Authorization Header Value postman.setGlobalVariable("Authorization", authHeaderValue); |
Hi All,
I am trying to POST the data using generic CSI API of Verint( Workforce Mnagement Tool) using API Key and Value. Unfortunately, the connection si not getting established. When executed the code using postman , the POST Request got succedded because there isa documentation with some prerequisite script in postman. Can someone help in fixing the below code.
Python Code 👍
import requests
api_key = "xxxxxxxx"
api_value = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Set up the headers with the API key and value
headers = {
"Content-Type": "application/json",
"X-Api-Key": api_key,
"X-Api-Value": api_value
}
data
data = {
"data": {
"type": "queueHistoryTimeSeries",
"id": 1,
"attributes": {
"queueTimeSeries": {
"dataSourceName": "AZ_Services_Datasource",
"queueName": "AZS_Test2",
"time": "2023-01-07T08:00:00.000-0700",
"reportInterval": 30,
"dataSourceGroupTimeSeries": [
{
"dataSourceGroupName": "TestG2",
"volumeActual": 80,
"volumeHandledActual": 90,
"averageSpeedToAnswerActual": 90,
"activityHandlingTimeActual": 120,
"serviceLevelActual": 50,
"abandonsActual": 90,
"backlogActual": 90,
"occupancyActual": 90,
"staffingActual": 90
}
]
}
}
}
}
Set up the endpoint URL
url = "http://xxxxxxxxxxxxxxxxxx/timeSeriesData"
Send a GET request to the endpoint with the headers
response = requests.post(url, headers=headers,data=data)
print(response.request.url)
print(response.request.headers)
print(response.request.body)
The text was updated successfully, but these errors were encountered: