FileCloud API - "Hello World" Exercise

"Hello World" for FileCloud is not exactly the program that prints Hello World.

  • We will see how to login and authenticate into FileCloud in a default authentication setting. 
  • These calls are fundamental to understand the XML messages that are used to communicate between the FileCloud server and client.

Authentication is a one step process.

  • The loginguest command is issued with account name and password. 
  • When authentication is complete and successful, the FileCloud HTTP server creates a cookie and returns the cookie value to the client through the HTTP header.

7.1 COMMAND: LOGINGUEST


loginguest command accepts the account name and password and attempts to login into the profile. The URL follows the standard format as we discussed above.

HTTP://HOST:PORT/CORE/OPERATION {? OPTIONAL PARAMS }


When applied for loginguest call, the above URL takes the form.


http://host:port/core/loginguest


The input parameters (see table below) userid and password must be passed as name/value pairs from client to FileCloud HTTP server as a part of HTML body through the HTTP POST method.
From the FileCloud Client, issue an HTTP POST command with the above URL when your FileCloud Development Instance is running.


When doing HTTP POST please ensure that the content-type is set correctly to "application/x-www-form-urlencoded"

Also, if you are connecting as an agent, additional parameters such as RMC details of the agent might be needed. To avoid that, we recommend spoofing the User-Agent and passing in any web browser User Agent String.

Header ParameterValue
content-typeapplication/x-www-form-urlencoded
User-Agent
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36


FileCloud HTTP server will return an XML result in the following format.
<commands>
	<command> 
		<type>loginguest</type> 
		<result>1</result> 
		<message> </message> 
	</command> 
</commands>


In the above XML response, RESULT 1 indicates that the profile was logged in successfully. As an additional help, use the FileCloud Logs to follow the communication between your client and FileCloud HTTP server.


Input HTTP,  Method: POST

PARAMETERRequiredDATA TYPEDESCRIPTION
useridYesStringaccount name
passwordYesStringClear Text password


Output

PARAMETERDescription
typeName of the call. Possible value is "loginguest"
result

Returns 1 if success, 0 is failed.

However, a RESULT 0 indicates the loginguest failed. Most likely cause will be password is not correct. password

messageReturns any error message generated in the call. 8 FILECLOUD

7.2 COMMAND: ADMINLOGIN


adminlogin command accepts the admin name and admin password and attempts to login into the admin site. The URL follows the standard format as we discussed above.

HTTP://HOST:PORT/ADMIN/?OP=OPERATION { &OPTIONAL PARAMS }


When applied for adminlogin call, the above URL takes the form.


http://host:port/admin/?op=adminlogin


The input parameters (see table below) op, adminuser and adminpassword must be passed as name/value pairs from client to FileCloud HTTP server as a part of HTML body through the HTTP POST method.
From the FileCloud Client, issue an HTTP POST command with the above URL when your FileCloud Development Instance is running.


When doing HTTP POST please ensure that the content-type is set correctly to "application/x-www-form-urlencoded"

We recommend spoofing the User-Agent and passing in any web browser User Agent String.

Header ParameterValue
content-typeapplication/x-www-form-urlencoded
User-Agent
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36


FileCloud HTTP server will return an XML result in the following format.
<commands>
	<command> 
		<type>adminlogin</type> 
		<result>1</result> 
		<message> </message> 
	</command> 
</commands>


In the above XML response, RESULT 1 indicates that the profile was logged in successfully. As an additional help, use the FileCloud Logs to follow the communication between your client and FileCloud HTTP server.


Input HTTP,  Method: POST

PARAMETERRequiredDATA TYPEDESCRIPTION
opYesStringOperation
adminuserYesStringAdmin user name
adminpasswordYesStringClear Text password


Output

PARAMETERDescription
typeName of the call. Possible value is "adminlogin"
result

Returns 1 if success, 0 is failed.

However, a RESULT 0 indicates the adminlogin failed.

messageReturns any error message generated in the call.