GetUserSettings
- Method
Slimcd.Login.GetUserSettings
Purpose
Get settings for a specific username/password.
Description
Retrieves a list of settings for the username/password, including transaction type permissions and any messages to be displayed to the user. Message blocks contain 5 rows. Multiple message blocks can be returned as multiple settings.
Business Rules
Request Fields
FieldNameTypeLengthRequiredDescriptionUserNamestring20requiredUsername or API Access Credential that accesses web service.Passwordstring20requiredPlaintext password for the client account.1 Passwords are required except when the username is set to an API Access Credential, in which case it should be passed in as an empty string.
2 If an API Access Credential is only authorized for a single sites, passing in the default siteid value of zero will close the currently open batch for that single site.
3 If the API Access Credential is authorized for multiple sites, the SiteID must be specified to indicate which batch to close.
3 If the username is set to a clientid or username other than an API Access Credential, you must specify a non-zero siteidto indicate which batch to close.
5 The batchnumber should always be passed as an empty string to close the open batch. Specifying a batch number will re-close an existing batch and may result in duplicate charges.
Reply Fields
replyouter tag for the reply data blockresponseSuccess, FAIL, Errorresponse code0, 1, 2 (respective) matching the abovedescriptionIf successful, this will contain the single word, OK. Otherwise it will contain a description of failure or error which occurredreponseurlThe Slimcd.com url which was called for this operationdatablockThe confirmation text returned from the server.Reply Hierarchy
- reply
- response
- responsecode
- description
- responseurl
- datablock
- Settings
- Setting
- UserType
- UserTypeID
- AllowSALE
- AllowAUTH
- AllowFORCE
- AllowVOID
- AllowCREDIT
- MessageLine1
- MessageLine2
- MessageLine3
- MessageLine4
- MessageLine5
- Setting
- Settings
Remarks
- General
- Names in name/value pairs are NOT case-sensitive
- Names inside XML tags ARE case-sensitive
- Function-Specific
- None
- reply
- Include
1<textarea readonly="readonly" rows="1" wrap="off"><script type="text/javascript" src="https://trans.slimcd.com/soft/json/slimcd.js"></script></textarea>
Method
123function GetUserSettings(request,callback)function GetUserSettings(request,timeout,callback)
request
1234<textarea readonly="readonly" rows="4" wrap="off">request= {"username": "1032","password": "289075"} </textarea>
Reply
1234567891011121314151617181920212223242526<textarea readonly="readonly" rows="29" wrap="off">callback ( {"reply":{"response": "Success","responsecode": "0","description": "OK","responseurl": "http://stats.slimcd.com/wswebservices/login.asmx/GetUserSettings","datablock": {"Settings": {"Setting": {"UserType": "A","UserTypeID": "1032","AllowSALE": "1","AllowAUTH": "1","AllowFORCE": "1","AllowVOID": "1","AllowCREDIT": "1","MessageLine1": null,"MessageLine2": null,"MessageLine3": null,"MessageLine4": null,"MessageLine5": null}}}} );</textarea>
Sample Code
123456789101112131415<textarea readonly="readonly" rows="18" wrap="off"><script type="text/javascript" src="https://trans.slimcd.com/soft/json/slimcd.js"></script><script type="text/javascript">SlimCD.Login.GetUserSettings({ "username": "1032","password": "289075"},function (reply) {if (reply.response == "Success") {alert ('Batch Closed');} else {alert('There was a problem closing the batch:\r\n' + reply.description);}});</script></textarea>
Downloads - Include
1<textarea readonly="readonly" rows="1" wrap="off">include 'slimcd.php';</textarea>
Method
1function Login_GetUserSettings(Login_GetUserSettingsRequest $request,$timeout=false)request
1234567<textarea readonly="readonly" rows="8" wrap="off">class Login_GetUserSettingsRequest{// property declarationpublic $username = '';public $password = '';}</textarea>JSON Reply
123456789101112131415161718192021222324<textarea readonly="readonly" rows="26" wrap="off">{"response": "Success","responsecode": "0","description": "OK","responseurl": "http://stats.slimcd.com/wswebservices/login.asmx/GetUserSettings","datablock": {"Settings": {"Setting": {"UserType": "A","UserTypeID": "1032","AllowSALE": "1","AllowAUTH": "1","AllowFORCE": "1","AllowVOID": "1","AllowCREDIT": "1","MessageLine1": null,"MessageLine2": null,"MessageLine3": null,"MessageLine4": null,"MessageLine5": null}}}</textarea>Sample Code
123456789101112131415161718<textarea readonly="readonly" rows="20" wrap="off">include 'slimcd.php';// Create the Slim CD object$SlimCD = new SlimCD() ;// Create a GetUserSettings Request class$request = new Login_GetUserSettingsRequest() ;$request->username = 1032;$request->password = 289075;$result = $SlimCD->Login_GetUserSettings($request);if ($result->response == 'Success') {echo 'Success!' ;}else {echo $result->response . ':' . $result->description ;}</textarea>Downloads
- Include
1<textarea readonly="readonly" rows="1" wrap="off">using SlimCD;</textarea>
Method
1<textarea readonly="readonly" rows="1" wrap="off">Public GetUserSettingsReply GetUserSettings(GetUserSettingsRequest request,int timeout);</textarea>request
12345<textarea readonly="readonly" rows="6" wrap="off">public class GetUserSettingsRequest{public string username { get; set; }public string password { get; set; }}</textarea>Reply
123456789101112131415161718192021<textarea readonly="readonly" rows="23" wrap="off">public class GetUserSettingsReply{public string response;public string responsecode;public string description;public string responseurl;public string usertype;public string usertypeid;public string allowsale;public string allowauth;public string allowforce;public string allowvoid;public string allowcredit;public string messageline1;public string messageline2;public string messageline3;public string messageline4;public string messageline5;public string senddata;public string recvdata;}</textarea>Sample Code
12345678910111213141516<textarea readonly="readonly" rows="19" wrap="off">SlimCD.Login login = new SlimCD.Login();login.debug = true;login.transURL = TransURL;GetUserSettingsRequest request = new GetUserSettingsRequest();GetUserSettingsReply reply = new GetUserSettingsReply();request.username = 1032;request.password = 289075;reply = login.GetUserSettings(request, 60);if (reply.response.ToUpper() == "SUCCESS"){MessageBox.Show("Success");}else{MessageBox.Show("There was a problem:\n(" + reply.response & ") " + reply.description);}</textarea>Downloads
- Include
1<textarea readonly="readonly" rows="1" wrap="off">using SlimCD;</textarea>
Method
12<textarea readonly="readonly" rows="2" wrap="off">Public async Task<GetUserSettingsReply> GetUserSettings(GetUserSettingsRequest request,int timeout);</textarea>request
12345<textarea readonly="readonly" rows="6" wrap="off">public class GetUserSettingsRequest{public string username { get; set; }public string password { get; set; }}</textarea>Reply
123456789101112131415161718192021<textarea readonly="readonly" rows="23" wrap="off">public class GetUserSettingsReply{public string response;public string responsecode;public string description;public string responseurl;public string usertype;public string usertypeid;public string allowsale;public string allowauth;public string allowforce;public string allowvoid;public string allowcredit;public string messageline1;public string messageline2;public string messageline3;public string messageline4;public string messageline5;public string senddata;public string recvdata;}</textarea>Sample Code
12345678910111213141516<textarea readonly="readonly" rows="19" wrap="off">SlimCD.Login login = new SlimCD.Login();login.debug = true;login.transURL = TransURL;GetUserSettingsRequest request = new GetUserSettingsRequest();GetUserSettingsReply reply = new GetUserSettingsReply();request.username = 1032;request.password = 289075;reply = await login.GetUserSettings(request, 60);if (reply.response.ToUpper() == "SUCCESS"){MessageBox.Show("Success");}else{MessageBox.Show("There was a problem:\n(" + reply.response & ") " + reply.description);}</textarea>Downloads
- Method
12345<textarea readonly="readonly" rows="6" wrap="off">public void getUserSettings(GetUserSettingsRequest loginUserSettingRequest,int timeout ,GetUserSettingsCallback callback )public void getUserSettings(GetUserSettingsRequest loginUserSettingRequest,GetUserSettingsCallback callback)</textarea>
request
12345678910111213141516171819202122232425<textarea readonly="readonly" rows="28" wrap="off"> public class GetUserSettingRequest {private String username;private String password;public GetUserSettingsRequest(){// set the default valueusername="";password="";}// setters and getters.public String getUsername() {return username;}public void setUsername(String username) {this.username = username;}public String getPassword() {return password;}public void setPassword(String password) {this.password = password;}}</textarea>Reply
12345678910111213141516171819202122232425262728293031323334353637383940<textarea readonly="readonly" rows="45" wrap="off">public class GetUserSettingReply {private String response;private String responsecode;private String description;private String responseurl;private Datablock datablock;// setters and getters.public String getResponse() {return response;}public void setResponse(String response) {this.response = response;}public String getResponsecode() {return responsecode;}public void setResponsecode(String responsecode) {this.responsecode = responsecode;}public String getDescription() {return description;}public void setDescription(String description) {this.description = description;}public String getResponseurl() {return responseurl;}public void setResponseurl(String responseurl) {this.responseurl = responseurl;}public Datablock getDatablock() {return datablock;}public void setDatablock(Datablock datablock) {this.datablock = datablock;}}</textarea>Sample Code
123456789101112131415161718192021222324<textarea readonly="readonly" rows="28" wrap="off">// set the request parameters.GetUserSettingsRequest request=new GetUserSettingsRequest();request.setUsername("1032");request.setPassword("289075");//To make web service request.new LoginGetUserSettings().getUserSettings(request, new GetUserSettingsCallback(){@Overridepublic void getUserSettingsReply(GetUserSettingsReply reply) {if (reply.getResponse().equals("Success"))textBox.setText("Success");elsetextBox.setText("There was a problem:\n" + reply.getResponse()+"\n Descriptin "+ reply.getDescription());}});</textarea>Downloads
- URL
1<a href="https://stats.slimcd.com/wswebservices/login.asmx?op=GetUserSettings" target="_blank">https://stats.slimcd.com/wswebservices/login.asmx/GetUserSettings</a>
Protocols
- SOAP/XML
- HTTP POST
- HTTP GET
Request
1<textarea readonly="readonly" rows="1" wrap="on">username=1032&password=289075</textarea>
The sample above shows the name/value pairs that would be send with HTTP POSTProtocol details for SOAP 1.1 and SOAP 1.2 can be found here:
https://stats.slimcd.com/wswebservices/login.asmx?op=GetUserSettingsStatus Codes
Status CodeStatus DescriptionExplanation200200 OKApproved or declined attempts will return a response with an XML reply block500500 Internal Server ErrorThe response will not contain XML, as a server error has occurred.Reply
Output is in XML format if a status code of 200 is returned.
12345678910111213141516171819202122232425262728<textarea readonly="readonly" rows="31" wrap="on"><?xml version="1.0" encoding="utf-8" ?><reply><response>Success</response><responsecode>0</responsecode><description>OK</description><responseurl>https://stats.slimcd.com/wswebservices/login.asmx/GetUserSettings</responseurl><datablock><Settings><Setting><UserType>A</UserType><UserTypeID>1032</UserTypeID><AllowSALE>1</AllowSALE><AllowAUTH>1</AllowAUTH><AllowFORCE>1</AllowFORCE><AllowVOID>1</AllowVOID><AllowCREDIT>1</AllowCREDIT><MessageLine1></MessageLine1><MessageLine2></MessageLine2><MessageLine3></MessageLine3><MessageLine4></MessageLine4><MessageLine5></MessageLine5></Setting></Settings></datablock></reply></textarea>If the <reply> block’s <response> tag does not indicate “Success”, the <description> tag will contain an error description which can be displayed to the end-user
Sample Code
12345<textarea readonly="readonly" rows="6" wrap="on">curl https://stats.slimcd.com/wswebservices/login.asmx/GetUserSettings--data-urlencode "username=1032"--data-urlencode "password=289075"--max-time 600</textarea>
The sample above shows the use of an API Access Credential with a blank password, and specifies a long timeout for CloseBatch1<a href="https://stats.slimcd.com/wswebservices/login.asmx/GetUserSettings?username=1032&password=289075">https://stats.slimcd.com/wswebservices/login.asmx/GetUserSettings?username=1032&password=289075</a>
The sample above shows the clientid, siteid and password. BatchNumber is always blank.Downloads
Exerciser Tool
Remarks
- Remarks Go here
- URL
1https://stats.slimcd.com/soft/json/jsonscript.asp?service=GetUserSettings
Protocols- HTTP POST
- HTTP GET
This function accepts either name/value pairs or JSON
Request
1234<textarea readonly="readonly" rows="4" wrap="off">{"username": "1032","password": "289075"}</textarea>1<textarea readonly="readonly" rows="1" wrap="off">&username=1032&password=289075</textarea>Reply
12345678910111213141516171819202122232425<textarea readonly="readonly" rows="28" wrap="off">{"reply": {"response": "Success","responsecode": "0","description": "OK","responseurl": "http://stats.slimcd.com/wswebservices/login.asmx/GetUserSettings","datablock": {"Settings": {"Setting": {"UserType": "A","UserTypeID": "1032","AllowSALE": "1","AllowAUTH": "1","AllowFORCE": "1","AllowVOID": "1","AllowCREDIT": "1","MessageLine1": null,"MessageLine2": null,"MessageLine3": null,"MessageLine4": null,"MessageLine5": null}}}}</textarea>Sample Code
12345<textarea readonly="readonly" rows="6" wrap="off">curl https://stats.slimcd.com/soft/json/jsonscript.asp?service=GetUserSettings--data-urlencode "username=1032"--data-urlencode "password=289075"--max-time 600</textarea>
The sample above shows the use of an API Access Credential with a blank password, and specifies a long timeout for CloseBatch1<a href="https://stats.slimcd.com/soft/json/jsonscript.asp?service=GetUserSettings&username=1032&password=289075">https://stats.slimcd.com/soft/json/jsonscript.asp?service=GetUserSettings&username=1032&password=289075</a>
The sample above shows the clientid, siteid and password. BatchNumber is always blank.1234567891011121314151617<textarea readonly="readonly" rows="19" wrap="off">$.ajax({type: 'POST',url: 'https://stats.slimcd.com/soft/json/jsonscript.asp?service=GetUserSettings',crossDomain: true,timeout: 600000,contentType: "application/json",data: { "username":"1032", "password":"289075" } ,dataType: 'jsonp',success: function(responseData, textStatus, jqXHR) {alert("reply=" + responseData.reply.response + ":" +responseData.reply.description) ;},error: function (responseData, textStatus, errorThrown) {alert('POST failed:' + textStatus + '=' + errorThrown);}});</textarea>
The sample above shows the use jQuery cross-domain POST with jsonp, sends an API Access Credential with a blank password, and specifies a long timeout for CloseBatch. Note that the service can be specified on the URL or inside the request object as another json data item12345678910111213141516171819<textarea readonly="readonly" rows="21" wrap="off">// This turns on cross-domain posts.$.support.cors=true;$.ajax({type: 'POST',url: 'https://stats.slimcd.com/soft/json/jsonscript.asp?service=GetUserSettings',crossDomain: true,timeout: 600000,contentType: "application/x-www-form-urlencoded",data: { "username":"1032", "password":"289075"} ,success: function(responseData, textStatus, jqXHR) {alert("reply=" + responseData.reply.response + ":" +responseData.reply.description) ;},error: function (responseData, textStatus, errorThrown) {alert('POST failed:' + textStatus + '=' + errorThrown);}});</textarea>
The sample above shows the use jQuery cross-domain POST with name/value pairs, sends an API Access Credential with a blank password, and specifies a long timeout for CloseBatch. Note that the service can be specified on the URL or inside the request object as another name/value pair123456789101112131415161718192021222324252627282930313233343536373839<textarea readonly="readonly" rows="43" wrap="off"><?php$data = array("username" => "1032", "password" => "289075" );$data_string = json_encode($data);$ch = curl_init('https://stats.slimcd.com/soft/json/jsonscript.asp?service=GetUserSettings');curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // receive server response ...curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);curl_setopt($ch, CURLOPT_HTTPHEADER,array('Content-Type: application/json','Content-Length: ' . strlen($data_string)));$server_output = curl_exec($ch);$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);$contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);if ($http_status != 200 ||($contentType <> 'text/javascript' && $contentType <> 'application/json')) {$reply = (object) array('response'=>'Error', 'responsecode'=>'2','description' => $server_output ,'responseurl' => curl_getinfo( $ch,CURLINFO_EFFECTIVE_URL) ,'datablock' => '');$result = (object) array('reply' => $reply) ;}else {$result = json_decode($server_output);}echo $result->reply->response . ':' . $result->reply->description;?></textarea>1234567891011121314151617181920212223242526272829303132333435363738394041<textarea readonly="readonly" rows="45" wrap="off"><?php$ch = curl_init("https://stats.slimcd.com/soft/json/jsonscript.asp?service=GetUserSettings");curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // receive server response ...curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query(array("username" => "1032","password" => "289075" ,)));$server_output = curl_exec ($ch);$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);$contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);if ($http_status != 200 ||($contentType <> 'text/javascript' && $contentType <> 'application/json')) {$reply = (object) array('response'=>'Error','responsecode'=>'2','description' => $server_output ,'responseurl' => curl_getinfo($ch,CURLINFO_EFFECTIVE_URL) ,'datablock' => '');$result = (object) array('reply' => $reply) ;}else {$result = json_decode($server_output);}curl_close ($ch);echo $result->reply->response . ':' . $result->reply->description;?></textarea>Remarks
- None