GetSessionFields
- Method
SlimCD.Sessions.GetSessionFields
Purpose
Get Session Fields .
Description
Returns all of the session’s “user data”. Any prefilled data will be stored here. Any fields on the page will also be displayed once the user clicks SUBMIT to save that data as the page is processed.
Business Rules
Argument List
Name Required Usage GetSessionFieldsRequest Required Object containing properties for the request timeout Optional Integer wait time, in seconds, before timeout response is generated callback* Optional Function to call upon completion of asynchronous request *for JavaScript only
GetSessionFields Request Fields
Field Name Type Length Required Description Username string 20 require Username or API Access Credential that accesses web service. Password string 20 require Plaintext password for the client account. SessionID string 40 require HEX string uniquely representing the session. 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.
Reply Fields
reply outer tag for the reply data block response Success, FAIL, Error response code 0, 1, 2 (respective) matching the above description If successful, this will contain the single word, OK. Otherwise it will contain a description of failure or error which occurred reponseurl The Slimcd.com url which was called for this operation datablock The confirmation text returned from the server. Reply Hierarchy
- reply
- response
- responsecode
- description
- responseurl
- datablock
- Fields
- Field
- FieldName
- FieldValue
- Field
- Fields
Remarks
- General
- Names in name/value pairs are NOT case-sensitive
- Names inside XML tags ARE case-sensitive
- Function-Specific
- None
- reply
- Include
012<script src="https://trans.slimcd.com/soft/json/slimcd.js"></script>
Method1234function GetSessionFields(request,callback)function GetSessionFields(request,timeout,callback)Request
1234567request= {"username": "1032","password": "289075","sessionid": "BCB7F196D64288552D1AEA27D52C3FF429CEB679"}Reply
12345678910111213141516171819202122232425262728callback ( {"reply":{"response": "Success","responsecode": "0","description": "OK","responseurl": "http://stats.slimcd.com/wswebservices/sessions.asmx/GetSessionFields","datablock": {"Fields": {"Field": [{"FieldName": "amount","FieldValue": "10.00"},{"FieldName": "mycustomfield","FieldValue": "mycustomvalue"},{"FieldName": "transtype","FieldValue": "SALE"}]}}}} );Sample Code
123456789101112131415161718<script src="https://trans.slimcd.com/soft/json/slimcd.js"></script><script>// <![CDATA[SlimCD.Sessions.GetSessionFields({"username": "1032","password": "289075","sessionid": "BCB7F196D64288552D1AEA27D52C3FF429CEB679"},function (reply) {if (reply.response == "Success") {alert ('Batch Closed');} else {alert('There was a problem closing the batch:\r\n' + reply.description);}});// ]]></script>Downloads
- Include
012include 'slimcd.php';
Method
123function Sessions_GetSessionFields (Sessions_GetSessionFieldsRequest $request,$timeout=false)Request
12345678910cclass Sessions_GetSessionFieldsRequest{// property declarationpublic $username = '';public $password = '';public $sessionid='';}JSON Reply
1234567891011121314151617181920212223242526{"response": "Success","responsecode": "0","description": "OK","responseurl": "http://stats.slimcd.com/wswebservices/sessions.asmx/GetSessionFields","datablock": {"Fields": {"Field": [{"FieldName": "amount","FieldValue": "10.00"},{"FieldName": "mycustomfield","FieldValue": "mycustomvalue"},{"FieldName": "transtype","FieldValue": "SALE"}]}}}Sample Code
12345678910111213141516171819include 'slimcd.php';// Create the Slim CD object$SlimCD = new SlimCD() ;// Create a GetSessionFields Request class$request = new Sessions_GetSessionFieldsRequest() ;$request->username = '1032';$request->password = '289075';$request->sessionid = "BCB7F196D64288552D1AEA27D52C3FF429CEB679";$result = $SlimCD->Sessions_GetSessionFields($request);if ($result->response == 'Success') {echo 'Success!' ;}else {echo $result->response . ':' . $result->description ;}Downloads
Download full sample source. - Include
123using SlimCD;
Method
123public GetSessionFieldsReply GetSessionFields(GetSessionFieldsRequest request, int timeout);Request
12345678public class GetSessionFieldsRequest{public string username { get; set; }public string password { get; set; }public string sessionid { get; set; }}Reply
123456789101112public class GetSessionFieldsReply{public string response;public string responsecode;public string description;public string responseurl;public string Fields;public string senddata;public string recvdata;}Cross Reference: Client
Sample Code
1234567891011121314151617181920SlimCD.Sessions sessions = new SlimCD.Sessions();sessions.debug = true;sessions.transURL = TransURL;sessions.statsURL = StatsURL;GetSessionFieldsRequest request = new GetSessionFieldsRequest();GetSessionFieldsReply reply = new GetSessionFieldsReply();request.username = 1032;request.password = 289075;request.sessionid = "BCB7F196D64288552D1AEA27D52C3FF429CEB679";reply = sessions.GetSessionFields(request, 60);if (reply.response.ToUpper() == "SUCCESS"){MessageBox.Show("Success");}else{MessageBox.Show("There was a problem:\n(" + reply.response & ") " + reply.description);}Downloads
Download full sample source. - Include
123using SlimCD;
Method
0123public async Task GetSessionFields(GetSessionFieldsRequest request,int timeout);Request
12345678public class GetSessionFieldsRequest{public string username { get; set; }public string password { get; set; }public string sessionid { get; set; }}Reply
12345678910111213public class GetSessionFieldsReplypublic class GetSessionFieldsReply{public string response;public string responsecode;public string description;public string responseurl;public string Fields;public string senddata;public string recvdata;}Cross Reference: Client
Sample Code
1234567891011121314151617181920SlimCD.Sessions sessions = new SlimCD.Sessions();sessions.debug = true;sessions.transURL = TransURL;sessions.statsURL = StatsURL;GetSessionFieldsRequest request = new GetSessionFieldsRequest();GetSessionFieldsReply reply = new GetSessionFieldsReply();request.username = 1032;request.password = 289075;request.sessionid = "BCB7F196D64288552D1AEA27D52C3FF429CEB679";reply = await sessions.GetSessionFields(request, 60);if (reply.response.ToUpper() == "SUCCESS"){MessageBox.Show("Success");}else{MessageBox.Show("There was a problem:\n(" + reply.response & ") " + reply.description);}Downloads
- Include
012#import "SlimCD.h"
Method
1234567typedef void (^SessionsGetSessionFieldsReplyBlock)(SessionsGetSessionFieldsReply *reply);- (void) sessionsGetSessionFieldsWithRequest:(SessionsGetSessionFieldsRequest*)request replyBlock:(SessionsGetSessionFieldsReplyBlock)replyBlock;- (void) sessionsGetSessionFieldsWithRequest:(SessionsGetSessionFieldsRequest*)request timeout:(NSTimeInterval)timeout replyBlock:(SessionsGetSessionFieldsReplyBlock)replyBlock;Request
123456789@interface SessionsGetSessionFieldsRequest@property (strong) NSString *userName;@property (strong) NSString *password;@property (strong) NSString *sessionID;@endReply
1234567@interface SessionsGetSessionFieldsReply : SlimCDReply@property (strong) NSMutableDictionary *userFields;@endSample Code
1234567891011121314151617181920SlimCD *api = [[SlimCD alloc] init];SessionsGetSessionFieldsRequest *request = [[SessionsGetSessionFieldsRequest alloc] init];request.userName = @"1032";request.password = @"289075";request.sessionID = @"12345";[api sessionsGetSessionFieldsWithRequest:request replyBlock:^(SessionsGetSessionFieldsReply *reply ){if ( reply.responseCode == RC_SUCCESS ){NSLog(@"Session fields returned successfully.");}else{NSLog(@"Unable to retrieve session fields.");}}]; - Method
12345public void getSessionFields(GetSessionFieldsRequest sessionFieldRequest,int timeout ,GetSessionFieldsCallback callback)public void getSessionFields(GetSessionFieldsRequest sessionFieldRequest,GetSessionFieldsCallback callback)
Request
1234567891011121314151617181920212223242526272829303132333435363738394041424344public class GetSessionFieldsRequest {// request parameters.private String username;private String password;private String sessionid;public GetSessionFieldsRequest(){// set default value.username="";password="";sessionid="";}// setter 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;}public String getSessionid() {return sessionid;}public void setSessionid(String sessionid) {this.sessionid = sessionid;}}Reply
1234567891011121314151617public class GetSessionFieldsReply {// response.private Fields fields=null;// setter and getters.public Fields getFields() {return fields;}public void setFields(Fields fields) {this.fields = fields;}}Sample Code
1234567891011121314151617181920212223242526// To set the request parameter.GetSessionFieldsRequest request=new GetSessionFieldsRequest();request.setUsername("1032");request.setPassword("289075");request.setSessionid("D3D16FCC052228B686A1838884574DAC6BF19394");// To call the web service.new SessionGetSessionFields().getSessionFields(request, new GetSessionFieldsCallback() {@Overridepublic void getSessionFieldsReply(GetSessionFieldsReply reply) {if (reply.getResponse().equals("Success"))textBox.setText("Success");elsetextBox.setText("There was a problem:\n" + reply.getResponse() +"\n Descriptin "+ reply.getDescription());}});Downloads
Download full sample source. - URL
Protocols
- SOAP/XML
- HTTP POST
- HTTP GET
Request
Status Codes
Status Code Status Description Explanation 200 200 OK Approved or declined attempts will return a response with an XML reply block 500 500 Internal Server Error The 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.
1234567891011121314151617181920212223<!--?xml version="1.0" encoding="utf-8" ?-->Success0OKhttps://stats.slimcd.com/wswebservices/sessions.asmx/GetSessionFieldsamount10.00mycustomfieldmycustomvaluetranstypeSALEIf the block’s tag does not indicate “Success”, the tag will contain an error description which can be displayed to the end-user
Sample Code
DOWNLOAD
EXERCISER TOOL
Remarks
- Remarks Go here
- URL
123https://stats.slimcd.com/soft/json/jsonscript.asp?service=GetSessionFields
Protocols
- HTTP POST
- HTTP GET
This function accepts either name/value pairs or JSON
Request
Reply
12345678910111213141516171819202122232425262728{"reply": {"response": "Success","responsecode": "0","description": "OK","responseurl": "http://stats.slimcd.com/wswebservices/sessions.asmx/GetSessionFields","datablock": {"Fields": {"Field": [{"FieldName": "amount","FieldValue": "10.00"},{"FieldName": "mycustomfield","FieldValue": "mycustomvalue"},{"FieldName": "transtype","FieldValue": "SALE"}]}}}}Sample Code
Remarks
- None