Jump to content
WAPT Forum

trish.mcdonough

Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About trish.mcdonough

  • Rank
    Newbie
  1. Hello, I'm hoping you can help me - I've been using WAPT ond an off for a number of years and thought I was relatively comfortable with it but this is the first time that the system we've built returns json rather than HTML and it's thrown me. Basically I've got a list screen which it returns a number of course approvals. For this scenario I would like to open a course approval which is not currently assigned to a user. I need to build up the variables for the URL for the next request. This is the json I'm getting back in the response: { "result" : { "items" : [ { "id" : 12, "application" : { "id" : 4, "course" : { "id" : 1000003, "provider" : { "providerName" : "First Ambulance" }, "courseType" : { "name" : "First Aid" } }, "applicationType" : { "name" : "Initial" } }, "approvalTypeId" : 1, "dueDate" : "2017-08-17", "visitDate" : null, "assignedToUser" : { "firstName" : "John", "surname" : "Smith", "location" : { "name" : "Glasgow Office" } }, "approvalStatus" : { "name" : "Pending" }, "approvalOutcomeId" : null }, { "id" : 20, "application" : { "id" : 11, "course" : { "id" : 1000010, "trainingProvider" : { "trainingProviderName" : "First Fire Trust" }, "courseType" : { "name" : "Fire Prevention" } }, "applicationType" : { "name" : "Initial" } }, "approvalTypeId" : 1, "dueDate" : "2017-08-17", "visitDate" : null, "assignedToUser" : null, "approvalStatus" : { "name" : "Pending" }, "approvalOutcomeId" : null }, { "id" : 22, "application" : { "id" : 13, "shortCourse" : { "id" : 1000012, "trainingProvider" : { "trainingProviderName" : "Business Development Inc" }, "courseType" : { "name" : "Accounting" } }, "applicationType" : { "name" : "Initial" } }, "approvalTypeId" : 1, "dueDate" : "2017-08-28", "visitDate" : null, "assignedToUser" : null, "approvalStatus" : { "name" : "Pending" }, "approvalOutcomeId" : null }, { "id" : 24, "application" : { "id" : 14, "course" : { "id" : 1000012, "trainingProvider" : { "trainingProviderName" : "Business Development Inc" }, "courseType" : { "name" : "Legal Entities" } }, "applicationType" : { "name" : "Initial" } }, "approvalTypeId" : 1, "dueDate" : "2017-08-28", "visitDate" : null, "assignedToUser" : null, "approvalStatus" : { "name" : "Pending" }, "approvalOutcomeId" : null } ], "count" : 4, "pageCount" : 1, "totalItemCount" : 4, "pageNumber" : 1, "pageSize" : 25, "hasPreviousPage" : false, "hasNextPage" : false, "isFirstPage" : true, "isLastPage" : true, "firstItemOnPage" : 1, "lastItemOnPage" : 4 }, "notifications" : [], "errors" : [], "succeeded" : true, "failed" : false } As you can see there are 4 course approvals being returned. The first one is assigned to a user (John Smith) so I want to pick one of the next three where "assignedToUser" : null and save the variables in order to build up the URL to be able to open that course approval. For the second approval in the json above the URL would be https://www.example.com/#/courses/1000010/applications/11/approval/20 So I need to save the courseID, the applicationID and the approvalID. My primary problems seem to be 1) the json is structured so that I need to drill up from the thing I want to match on 2) there are nested { } so that I can't use those as the search parameter to grab the element I want 3) there are three variables called 'ID' so a) I can't use that to grab the element I want and I need to differentiate between them based on where they are in the json 4) I tried using the jpath parameter and either I'm using it wrongly or the json isn't the right format because even a simple test like $jPath(/Element[2],NO) returns Error : cannot find the specified value in the server response I'm sure there is a really simple answer to this but I'm a bit stumped. Please can you point me in the right direction? Thanks, Trish
  2. Thanks for the reply Sergei. Alas I've WAPT 7.1 but at least I know now, it was driving me nuts because I was convinced I was just not using it correctly.
  3. Apologies if this has been answered before - I couldn't follow the solutions in any similar questions. We have a system with 'semantic' URLs so instead of http://www.domain.com/case/view.aspx?caseid=48 we have http://www.domain.com/case/48/view The profile I'm attempting to run includes creating a 'case' and then performing further actions on it. The 'user' completes http://www.domain.com/case/add and is then redirected to the view screen of the case they have just created - the URL of which is (for example) http://www.domain.com/case/48/view. The response consists of two parts, firstly a redirect - the response body of which is: <html><head><title>Object moved</title></head><body> <h2>Object moved to <a href="/case/48/view">here</a>.</h2> </body></html> and then the http://www.domain.com/case/48/view page. This response body does not contain the CaseID anywhere - it is only in the URL. I was trying to use the $Search function to set the 'caseID' variable from the first response (the redirect) but I couldn't get it to work - I found this article which confirmed that the variables are only set from the latest response. I can't use the $UrlParam to get the case ID from the URL due to it being a semantic URL (no ?, = or &). As the response body doesn't not contain the case ID - I have to extract it from the URL. The $Search function only works on the Response Body (it doesn't include the URL) - so how do I do this? Apologies if this is obvious - all my previous profiles were very straight forward and I'm quite stumped with this issue. Thanks in advance. Trish
×
×
  • Create New...