Skip to content
This repository has been archived by the owner on Dec 20, 2022. It is now read-only.

Java script for set variable doesn't work #96

Open
jeus opened this issue Mar 31, 2022 · 1 comment
Open

Java script for set variable doesn't work #96

jeus opened this issue Mar 31, 2022 · 1 comment

Comments

@jeus
Copy link

jeus commented Mar 31, 2022

All of my services working with JWT token and I using a first login api call for getting JWT token and after that I using JS code for set JWT token for next api calls. but it doesn't work here.
`
#Step #1 Longin by Tenant Admin
POST {{schema}}{{host}}/api/auth/login
Content-Type: application/json

{
"username": "{{username}}",
"password": "{{password}}"
}

{%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
var objJson = JSON.stringify(response.body);
var json = JSON.parse(objJson);
var jwt_token = json.token;
var refreshToken = json.refreshToken;
var mfa_token = json.mfaToken;
client.global.set("jwt_token",jwt_token);
client.global.set("mfa_token",mfa_token);
client.global.set("refreshToken",refreshToken);
client.log(jwt_token);
});
%}

POST {{schema}}{{host}}/api/connectivity/createTriggerPackage/company/63000032?name=TEEEST11&description=TEEESTDESC
X-Authorization: Bearer {{jwt_token}}
Content-Type: application/json

{
"triggerMetric": [
{
"actionActive": false,
"actionValue": "1",
"alertActive": true,
"alertValue": 1,
"timeFrame": "1",
"triggerName": "TEEEST11",
"triggerNumber": "10"
}
]
}
`
this commands work in intellij idea Http client but didn't work on restcli

@mrichhudson
Copy link

I have the exact same issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants