Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $( document ).ready(function() {
- // authorization data
- var username = "medrockweek1";
- var password = "medrockweek1";
- // api query urls
- var baseUrl = 'https://rest.ehrscape.com/rest/v1';
- var queryUrl = baseUrl + '/query';
- function getSessionId() {
- var response = $.ajax({
- type: "POST",
- url: baseUrl + "/session?username=" + encodeURIComponent(username) +
- "&password=" + encodeURIComponent(password),
- async: false
- });
- return response.responseJSON.sessionId;
- }
- var sessionId = getSessionId();
- // console.log(sessionId);
- function getRequest(ehrId) {
- $.ajax({
- url: baseUrl + "/view/" + ehrId + "/weight",
- type: 'GET',
- headers: {"Ehr-Session": sessionId},
- success: function (data) {
- console.log(data);
- }
- });
- }
- // test of our ehrid
- getRequest("50bc1c98-8540-4d86-bbc7-813f7c55377e");
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement