Site Tools


guides:ws_payloads_get_repository_file_names

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
guides:ws_payloads_get_repository_file_names [2020/08/24 18:19] brett.zamoraguides:ws_payloads_get_repository_file_names [2022/03/29 17:22] (current) brett.zamora
Line 36: Line 36:
 {{tablelayout?colwidth="150px,250px,250px"&rowsFixed=1&rowsVisible=10&float=center}} {{tablelayout?colwidth="150px,250px,250px"&rowsFixed=1&rowsVisible=10&float=center}}
 ^ Column Name ^ Comparators ^ Allowed Values ^ ^ Column Name ^ Comparators ^ Allowed Values ^
-| FILE_NAME | Equals, Contains, StartsWith, EndsWith | Any string data. | +| FILE_NAME | Equal, Contains, StartsWith, EndsWith | Any string data. | 
-| LOCK_STATUS | Equals | Locked, Unlocked, All | +| LOCK_STATUS | Equal | Locked, Unlocked, All | 
-| DATE_CREATED | Equals, Greater, GreaterEqual, Less, LessEqual | Any valid date in format MM-dd-yyyy | +| DATE_CREATED | Equal, Greater, GreaterEqual, Less, LessEqual | Any valid date in format MM-dd-yyyy | 
-| DATE_MODIFIED | Equals, Greater, GreaterEqual, Less, LessEqual | Any valid date in format MM-dd-yyyy |+| DATE_MODIFIED | Equal, Greater, GreaterEqual, Less, LessEqual | Any valid date in format MM-dd-yyyy |
  
  
Line 67: Line 67:
 **Endpoint:** **Endpoint:**
  
-<nowiki>https://apex-prd.certna.org/APEX/Service/APEXPublicServer.svc/payloads/processed? filter=date_created:GreaterEqual:9-1-2019;date_created:Less:9-30-2019;date_modified:GreaterEqual:9-1-2019;date_modified:Less:9-30-2019;file_name:Contains:user-033;lock_status:Equal:Unlocked&page_size=10&page=1&order=Descending</nowiki>+<nowiki>https://apex-prd.certna.org/APEX/Service/APEXPublicServer.svc/payloads/processed? filter=date_created:GreaterEqual:9-1-2019;date_created:Less:9-30-2019;date_modified:GreaterEqual:9-1-2019;date_modified:Less:9-30-2019;file_name:Contains:user-033;lock_status:Equal:Unlocked&page_size=10&page=1&order=file_name:Descending</nowiki>
  
  
Line 131: Line 131:
 Following is a C# / .NET sample code snippet that shows how to call the payloads:get_repository_file_names web service. Following is a C# / .NET sample code snippet that shows how to call the payloads:get_repository_file_names web service.
  
-This snippet was derived from Web Service Toolbox that is available on the CeRTNA Wiki. The sample application is intended for easy to read demonstration purposes and not production quality code. The Web Service Toolbox application is documented, on the CeRTNA Wiki, to aid in understanding the code snippet shown below.+This snippet was derived from the [[guides:web_service_toolbox_project|Web Service Toolbox]] that is available on the CeRTNA Wiki. The sample application is intended for easy to read demonstration purposes and not production quality code. The [[guides:web_service_toolbox_project|Web Service Toolbox]] application is documented, on the CeRTNA Wiki, to aid in understanding the code snippet shown below.
  
  
 <code C#> <code C#>
 +private string[] getRepositoryFileNames(string strRepositoryName)
 +{
 +    string[] strFileNames = null;
 +
 +    RestClient client = null;
 +    RestRequest request = null;
 +    IRestResponse response = null;
 +
 +    string strURL = "https://apex-prd.certna.org/APEX/Service/APEXPublicServer.svc/user/login";
 +
 +    // Password has to be hashed.
 +    // New convention uses a Salt value from the user record
 +    // See Login documentation for more details
 +
 +    string strSalt = GetSalt(tbUserName.Text);
 +    string strPassword = tbPassword.Password.ToString();
 +
 +    string strHashedPassword = HashPassword(strPassword, strSalt);
 +
 +    string strParms = "{\n\t\"user_name\" : \"";
 +    strParms += tbUserName.Text;
 +    strParms += "\",\n\t\"password\" : \"";
 +    strParms += strHashedPassword;
 +    strParms += "\"\n}";
 +
 +    client = new RestClient(strURL);
 +    request = new RestRequest(Method.POST);
 +
 +    request.AddHeader("Cache-Control", "no-cache");
 +    request.AddHeader("Content-Type", "application/json");
 +
 +    request.AddParameter("Login", strParms, ParameterType.RequestBody);
 +    response = client.Execute(request);
 +
 +    if (response.IsSuccessful)
 +    {
 +        var jsonResult1 = JsonConvert.DeserializeObject<dynamic>(response.Content);
 +        string token = jsonResult1.access_token;
 +
 +        strURL = null;
 +        client = null;
 +        request = null;
 +        response = null;
 +
 +        strURL = "https://" + getHost() + "/APEX/Service/APEXPublicServer.svc/payloads/" + strRepositoryName; 
 +
 +        client = new RestClient(strURL);
 +        request = new RestRequest(Method.GET);
 +
 +        request.AddHeader("Cache-Control", "no-cache");
 +        request.AddHeader("access_token", token);
 +        response = client.Execute(request);
 +
 +        if (response.IsSuccessful)
 +        {
 +            JObject joResponse = JObject.Parse(response.Content);
 +            JArray array = (JArray)joResponse["result"];
 +
 +            strFileNames = new string[array.Count];
 +
 +            for (int i = 0; i < array.Count; i++)
 +            {
 +                strFileNames[i] = (String)array[i]["file_name"];
 +            }
 +        }
 +        else
 +        {
 +            var jsonResult2 = JsonConvert.DeserializeObject<dynamic>(response.Content);
 +            string strMessage = jsonResult2.Exception.Message;
 +            tbMessageLine.Text = strMessage;
 +        }
 +    }
 +    else
 +    {
 +        var jsonResult2 = JsonConvert.DeserializeObject<dynamic>(response.Content);
 +        tbMessageLine.Text = jsonResult2.ToString();
 +    }
 +    return (strFileNames);
 +}
 </code> </code>
  
  
 +**Comment 2:**
 +
 +A nice utility for experimenting with web service calls is POSTMAN. You can download a free version of POSTMAN from the following URL: https://www.getpostman.com/apps
  
  
guides/ws_payloads_get_repository_file_names.1598293198.txt.gz · Last modified: by brett.zamora