API & Web Services
Portal Web Services
7 min
end point ā soap url http //services dfsmail com/services/clientportalservice svc http //services dfsmail com/services/clientportalservice svc encoding ā mtom upload file size limit ā 250 mb token to generate a token (api key), the proper security role needs to be added to your user account from dfs the api key will be linked to the specific user, therefore, that user must have proper permissions to perform actions on behalf of that customer ⢠url http //security dfsmail com/ http //security dfsmail com/ ⢠click on api keys menu option and click add to generate a new token (example below) add the token to the service reference configuration inside the endpoint section example \<client> \<endpoint address="https //services dfsmail com/services/clientportalservice svc" binding="basichttpbinding" bindingconfiguration="basichttpsbinding iclientportalservice" contract="servicereference1 iclientportalservice" name="basichttpsbinding iclientportalservice" > \<headers> \<token>{api key}\</token> \</headers> \</endpoint> \</client> notes the customer number (id) is required as a parameter in all the methods to avoid conflict of getting or updating information from another customer to find customers id, use the getcustomers() method the get a list of customers and their ids for that user if the start and end date are sent as null it will automatically search for the last seven days the maximum date range for the search is 31 days if is more than that the service will throw an exception methods //get all the work orders pending for authorization for the specified customer and job name ienumerable\<e workorder> getworkorderpendingauthorizationbyjobname (int customerid, string jobname); //approve a work order (job) with pending for authorization status sending customer id and work order id (job id) bool aprovejob(int customerid, int jobid); //reject a work order (job) with pending for authorization status sending customer id and work order id (job id) bool rejectjob(int customerid, int jobid, string comments); //get a list of open work orders (jobs) ienumerable\<e workorderdetails> getallworkorders(int customerid); //get a list of open work orders (jobs) with a specific status ienumerable\<e workorderdetails> getworkordersbystatus(int customerid, string status); //get a list of open work orders (jobs) with a date range ienumerable\<e workorderdetails> getworkordersbydate(int customerid, datetime? startdate, datetime? enddate); //get a list of closed work orders (jobs) with a date range ienumerable\<e workorder> getallworkordershistory(int customerid, datetime? startdate = null, datetime? enddate = null); //get customer current postage balance decimal getcurrentbalance(int customerid); //get a list of postage records by date range ienumerable\<e postagehistory> getpostagehistorylist (int customerid, datetime? startdate = null, datetime? enddate = null, string type = null); //get a list of items related to the customer ienumerable\<e item> getallitems(int customerid); //get a list of items related to the customer and contains the name sent in the parameter ienumerable\<e item> getitemsbyname(int customerid, string itemname); //get list of related customers to the user (customer , customer name) dictionary\<int, string> getcustomers(); //upload file to portal customers files void uploadfiles(int customerid, string filename, system io stream file); example service clientportalserviceclient client = new service clientportalserviceclient(); string filepath = (@"c \testupload zip"); filestream fs = new filestream(filepath, filemode open, fileaccess read); client uploadfiles(137, "testupload zip", fs); entities public class item { public string number { get; set; } public string name { get; set; } public int qtytotalatday { get; set; } } public class postagehistory { public int? id { get; set; } public datetime paymentdate { get; set; } public string transactiontype { get; set; } public int? workorderid { get; set; } public decimal amount { get; set; } public decimal startingbalance { get; set; } public decimal endingbalance { get; set; } public string reference { get; set; } } public class workorder { public int id { get; set; } public string name { get; set; } public datetime createdate { get; set; } public datetime? duedate { get; set; } public string status { get; set; } } public class workorderdetails workorder { public string statusid { get; set; } public int customerid { get; set; } public string customername { get; set; } public datetime arrivaldate { get; set; } public datetime departuredate { get; set; } public int printingpercentage { get; set; } public int insertingpercentage { get; set; } }

