==== payloads:get_repository_file_names ====
The payloads web service is a REST structured service that derives its functionality based on syntax used when calling the web service. When including the repository name in the payloads web service call, a list of file names will be returned along with the date the file was created, the lock status of the file, and the date the file was last modified. A variety of filters are available and are documented below.
----
**Purpose:** **Get Payload File Names For Selected Repository**
Request Endpoint
{{tablelayout?colwidth="75px,575px"&rowsFixed=1&rowsVisible=10&float=center}}
^ Method ^ URL ^
| GET | https://apex-prd.certna.org/APEX/Service/APEXPublicServer.svc/payloads/{repository}?{filter}&page_size={page_size}&page={page_index}&order={order} |
**Variables:**
{{tablelayout?colwidth="100px,75px,475px"&rowsFixed=1&rowsVisible=10&float=center}}
^ Variable ^ Usage ^ Description ^
| {repository} | Required | The name of the repository |
**Arguments:**
{{tablelayout?colwidth="100px,75px,475px"&rowsFixed=1&rowsVisible=10&float=center}}
^ Variable ^ Usage ^ Description ^
| {filter} | Optional | Collection of {column_name}:{comparator}:{value} separated by ';' symbol. |
| {page_size} | Optional | A positive integer representing the number of items returned for a single page of results. |
| {page} | Optional | A positive integer representing the page index of the result set. First index is 0. |
| {order} | Optional | Sort order of the returned data. Format {column_name}:{sort_type}. Valid {sort_type) Ascending or Descending |
**Filter Usage:**
{{tablelayout?colwidth="150px,250px,250px"&rowsFixed=1&rowsVisible=10&float=center}}
^ Column Name ^ Comparators ^ Allowed Values ^
| FILE_NAME | Equal, Contains, StartsWith, EndsWith | Any string data. |
| LOCK_STATUS | Equal | Locked, Unlocked, All |
| DATE_CREATED | Equal, 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 |
Request Body
N/A
Request Headers
{{tablelayout?colwidth="150px,450px"&rowsFixed=1&rowsVisible=10&float=center}}
^ Key ^ Value ^
| access_token | {soft-token} |
JSON Request Parameters
N/A
**Notes:**
Any condition that results in an unsuccessful call to the payloads web service will produce a JSON formatted response with a code and message property populated.
Sample Request
**Endpoint:**
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
Sample Response
Status Code: 200
{
"result": [
{
"created": "2019-09-03 16:56:04",
"file_name": "standard_user-033-190903161430419-00001.1.1_190903165601809",
"lock_status": "Unlocked",
"modified": "2019-09-03 16:56:18"
},
{
"created": "2019-09-03 16:56:04",
"file_name": "standard_user-033-190903161430419-00002.1.1_190903165601809",
"lock_status": "Unlocked",
"modified": "2019-09-03 16:56:23"
},
{
"created": "2019-09-03 16:56:04",
"file_name": "standard_user-033-190903161430419-00003.1.1_190903165601809",
"lock_status": "Unlocked",
"modified": "2019-09-03 16:56:24"
},
{
"created": "2019-09-03 16:56:04",
"file_name": "standard_user-033-190903161430419-00004.1.1_190903165601809",
"lock_status": "Unlocked",
"modified": "2019-09-03 16:56:17"
},
{
"created": "2019-09-03 16:58:54",
"file_name": "standard_user-033-190903161430419-00050.1.1_190903165852480",
"lock_status": "Unlocked",
"modified": "2019-09-03 16:59:08"
}
]
}
**OR**
Status Code: 500 (When an error occurs.)
{
"Exception": {
"Code": "Undefined",
"Message": "Invalid filter condition field name - \"lock_value\""
}
}
**Comment 1:**
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 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.
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(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(response.Content);
string strMessage = jsonResult2.Exception.Message;
tbMessageLine.Text = strMessage;
}
}
else
{
var jsonResult2 = JsonConvert.DeserializeObject(response.Content);
tbMessageLine.Text = jsonResult2.ToString();
}
return (strFileNames);
}
**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