REST APIs
UserRsource:
Create or update ghost user
| Methpd |
PUT |
| Action |
Create or update a ghost user. |
| Desc |
Create a ghost user or update it or resend confirmation email. To create a ghost user the resource check for a valid captcha to be received with the the new user information. The resource check the validation of the captcha if it is not valid an error message is sent back to the client otherwise the a new ghost user is created and a confirmation email is sent to his registration email, if the referral sent in this stage the referral userId is saved in the ghost user but no additional quota will be added to him until the setup registration succeed.
To update a ghost user a session cookie is checked first if it is not valid an error message is sent back to the client otherwise the user ill be updated .to send a confirmation email if user is already created but still not confirmed |
| Authentication |
In create user case the request is authenticated using the captcha while in the update case it is authenticated using the session cookie.
There is authentication in the resend confirmation email case. |
| https |
required. |
| Process |
In create user case, The client issue a PUT request to the URI: https://g.ho.st/rest/users/{username}, providing the username{username}, password, registration email, and the captcha, other additional attributes can be sent too which are the referrerUrl,the promotion code, and the referral. After checking the captcha validation the ghost user is saved a confirmation email is sent to his registration email. if the referral sent in this stage the referral userId is saved in the ghost user but no additional quota will be added to him until the setup registration succeed.Also if promotion code sent in this stage it will be handled and the quota will added to the user.
While In the update user case first name, middle name, last name, address, promotion code, and a referrer ghost user are sent. The resource first check for a valid session cookie if there isn't any an error message is sent back to the client otherwise ghost user is updated. In the resend confirmation email case the parameters needed are the username,password and the email address if the user wishes to change his registration email. if there is an email sent with the resend confirmation email case it will be saved in the ghost user as diverted email so in the setup registration the user will choose his old registration email or the other sent on to be set as his final choice to be the registration email before updating the user and the temporary email will be removed from user. [it10] |
| Parameters |
username: user id
password: user password
email : registration email.
captcha: captcha challenge.
firstName : first name.
middleName :middle name.
lastName : last name.
address (zip or countryId): zip code or country Id.
promotionCode : promotion code.
referral : Referrer ghost user.
receiveUpdates: true / false.
receiveUpdatesOnGhEmail: true/ false.
lang : language name
referrerUrl : holds registration referrer url, it represents too the promotionUrl.
referrerTag : it another name for referrerUrl.and it is saved as referreuUrl.
quota : boolean (true/ false); |
| Return |
HTTP header
HTTP/1.1 200 OK |
| Response body |
In create User case:
<ghostResult>
<status>
<httpStatus code="200">Ok</httpStatus>
</status>
<ghData>
Ghost user created successfully and a confirmation email was sent
</ghData>
</ghostResult>
In update User case:
<ghostResult>
<status>
<httpStatus code="200">Ok</httpStatus>
</status>
<ghData>Ghost user updated successfully
</ghData>
</ghostResult>
In update User case and quota=true :
<ghostResult>
<status>
<httpStatus code="200">Ok</httpStatus>
</status>
<ghData>Ghost user updated successfully
<storageInfo>
<quota>{quota}</quota>
<bouns>{bouns}</bouns>
<total>{total}</total>
<used>{used}</used>
<free>{free}</free>
<invitation>{invitation}</invitation>
<promotions>{promotions}</promotions>
</storageInfo>
</ghData>
</ghostResult>
In resend confirmation email case:
<ghostResult>
<status>
<httpStatus code="200">Ok</httpStatus>
</status>
<ghData>Confirmation email was resent successfully </ghData>
</ghostResult>
|
Get ghost user
| Method |
GET |
| Action |
get a ghost user. |
| Desc |
This resource can be used to get the information of a ghost user or to get suggestion for the username in the registration process. |
| Authentication |
required. if there is no session cookie, we will return the basic info first name, last name and country.[it10] |
| https |
not required. |
| Process |
A get request is sent to the client, the username is extracted from the URI and the resource get the user with this username. If it was not found an error message is sent back to the client explaining that this user was not found. Otherwise a parameter called "suggestion" is checked, if it is false then the user info is sent back to the client otherwise a other suggestion for available usernames are generated and are sent back to the client. |
| Parameters |
username: see common parameters section
suggestion: It indicates whether suggestion for other username are required in case this username was already used. |
| Return |
HTTP header
HTTP/1.1 200 OK
The session ID will also be returned in a cookie which may be attached to subsequent requests. |
| Response body |
If request is authorized and 'suggestion'= false:
<ghostResult>
<status>
<httpStatus code="200">Ok</httpStatus>
</status>
<ghData>
<ghostuser>
<identity id={id} title={titleId} titleDesc={titleDescrip}
firstName="MishSana" midName="" lastName="Mish25"
birthdate="" gender="0"/>
<Address addressId="0" country="0"
countryDesc="" city="" state="" postalAddress=""
zipcode="972" addressType="1"/>
<AccountOptions receiveUpdates="true"
receiveUpdatesOnGhEmail="true"
referrer={referrer username}/>
<contactMethod email={email}/>
</ghostuser>
</ghData>
</ghostResult>
If request is not authorized,'suggestion'= true and username is not available :
<ghostResult>
<status>
<httpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="202">INVALID_PASSWORD
<suggestion>
<sug>{sug_1}</sug>
<sug>{sug_2}</sug>
<sug>{sug_3}</sug>
<sug>{sug_4}</sug>
</suggestion>
</ghStatus>
</status>
</ghostResult>
If request is not authorized,'suggestion'= true and the username is available :
<ghostResult>
<status>
<httpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="200">USER_NOT_FOUND</ghStatus>
</status>
</ghostResult>
If request is not authorized,'suggestion'= false and the username is not available [it10] :
<ghostResult rev="5446">
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
<firstName>{first name}</firstName>
<lastName>{last name}</lastName>
</ghData>
</ghostResult>
|
Resource: Session
Create a Temporary WebDAV or FTP session id
| Method |
POST |
| Action |
Create a temporary webdav or ftp session ID. |
| Desc |
Create a session for a user, e.g. Fred. Creates a session and returns a sessionID, a base64 string which includes the userid, expiry time and a digital signature. The sessionId will be valid for 30 minutes. |
| Authentication |
Required |
| https |
required. |
| Process |
The client issue a request to the URI: https://g.ho.st/vcweb/rest/users/{username}/session, providing the right username{username} and sessionType (dav, ftp) |
| Parameters |
| Required |
Name |
Type |
Description |
| required |
username |
string |
The user name is the user Id assigned to the user. |
| required |
sessionType |
string |
values are either "ftp" or "dav". This specifies the type of session required |
| optional |
callerID |
string |
the name of the application requesting the temp session. Example (GUDU, Synch) |
|
| Return |
HTTP header
HTTP/1.1 200 OK |
| Response body |
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
<session uid="{username}">
c2hvdWtyeToyMDA4LTEyLTIyVDExOjM3OjM2Ljk0NVo=:OTOESKvMMVSw9OJdj9iTCt0iZq0=
</session>
</ghData>
</ghostResult>
|
| Errors |
| Bad Request (400) |
The request could not be understood by the server due to malformed syntax
This error occurs when there is a problem parsing request parameters.
Response HTTP header: HTTP/1.1 500
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="400">Bad Request</httpStatus>
<ghStatus code="400">Invalid Session Type</ghStatus>
</status>
</ghostResult>
|
| Unauthorized (401) |
The server failed to authorize the provided user name and password.
The Unauthorized error code is returned in one of the following situations:
1. The username match a GhostUserin G.ho.st, but the password dose not match.
2. The username match a GhostUserin G.ho.st, but there is no password, neither there is not remember password cookie
3. The username match a GhostUser in G.ho.st but there is no password, and there is an invalid remember password cookie.
Response HTTP header: HTTP/1.1 401
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="200">INVALID_PASSOWRD</ghStatus>
</status>
</ghostResult>
|
| Not Found (404) |
Username doesn't match any existing user id.
Response HTTP header: HTTP/1.1 401
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="200">USER_NOT_FOUND</ghStatus>
</status>
</ghostResult>
|
| Internal Server Error (500) |
The server encountered an unexpected condition which prevented it from fulfilling the request
Response HTTP header: HTTP/1.1 500
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="500">Internal Server Error</httpStatus>
<ghStatus code="000">dummy code</ghStatus>
</status>
</ghostResult>
|
Create a session id - POST
| Action |
Create a session ID. |
| Desc |
Create a session for a user, e.g. Fred. Creates a session and returns a sessionID, a base64 string which includes the userid, expiry time and a digital signature. The same API call will result in creating and attaching a session cookie to the response. The sessionId and the cookie are the same, it allow the caller to call other API's without further authentication requests, the only difference is that the cookie will get renewed each 5 min when the caller interact with G.ho.st, and stay valid for one hour long in ideal cases, on the other hand, the sessionId will be valid for one hour, and will not be renewed in each request, that mean, at creating time, cookie signature, and the session id will be the same at the first successfully login, after that there is no guarantee that the two keys: sessionId and the cookie signature are the same.
Please also note that the caller can call the session URI without the password (https://g.ho.st/rest/users/{username}/session), in such case the server will check the server will validate the request against the remember password cookie. |
| Authentication |
Not required. |
| https |
required. |
| Process |
The client issue a POST request to the URI: https://g.ho.st/rest/users/{username}/session, providing the right username{username} and password. A remember password cookie (with userid, expiry date, digital signature) may be provided instead of password.
The server find the GhostUser with the provided userName, other wise it will reject the call and terminate the login process.
The server will then try validate the provided password:
If password = null: the server will validate the request using the provided remember password cookie if available, else it will reject the call and terminate the login process.
If password != null: the server will validate the password by comparing it with the one hashed in the database, and will accept the call if they matched, else it will reject the request and terminate the login process. |
| Parameters |
| Required |
Name |
Type |
Description |
| required |
username |
string |
The user name is the user Id assigned to the user. |
| required |
passowrd |
string |
user password |
| optional |
client |
string |
the source of which user signed in, it can be the browser or pixie.and it is saved in the sign in logger. |
|
| Return |
HTTP header
HTTP/1.1 200 OK
The session ID will also be returned in a cookie which may be attached to subsequent requests. |
| Response body |
Note: Cookie value will include a <sig> tag, which wrap the sessionId generated by the server, it's the same as the one returned in the response body, except that the one returned in the comes with a timestamps attached to the end of it.
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status><httpStatus code="200">OK</httpStatus> </status>
<ghData>
<session uid="sana2">
KZjnTCTNou3qmGekHAyk3pdg1xw=_2008-05-11T08:34:53.018Z
</session>
</ghData>
</ghostResult>
|
| Errors |
| Bad Request (400) |
The request could not be understood by the server due to malformed syntax
This error occurs when there is a problem in parsing either the request string or the request time.
Response HTTP header: HTTP/1.1 500
Response HTTP body
When there is an error in parsing the request string, the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="400">Bad Request</httpStatus>
<ghStatus code="010">PARSING_STRING_ERROR</ghStatus>
</status>
</ghostResult>
and when the there is an error in parsing the request time, the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="400">Bad Request</httpStatus>
<ghStatus code="012">PARSING_TIME_ERROR</ghStatus>
</status>
</ghostResult>
|
| Unauthorized (401) |
The server failed to authorize the provided user name and password.
The Unauthorized error code is returned in one of the following situations:
1. The username match a GhostUserin G.ho.st, but the password dose not match.
2. The username match a GhostUserin G.ho.st, but there is no password, neither there is not remember password cookie
3. The username match a GhostUser in G.ho.st but there is no password, and there is an invalid remember password cookie.
Response HTTP header: HTTP/1.1 401
Response HTTP body
for invalid password:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="202">INVALID_PASSWORD</ghStatus>
</status>
</ghostResult>
|
| Not Found (404) |
Username doesn't match any existing user id.
Response HTTP header: HTTP/1.1 401
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="200">USER_NOT_FOUND</ghStatus>
</status>
</ghostResult>
|
| Internal Server Error (500) |
The server encountered an unexpected condition which prevented it from fulfilling the request
Response HTTP header: HTTP/1.1 500
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="500">Internal Server Error</httpStatus>
<ghStatus code="000">dummy code</ghStatus>
</status>
</ghostResult>
|
Update a session cookie
| Method |
POST. |
| Action |
Update a session cookie. |
| Desc |
updates a session cookie if user already have a valid one. |
| Authentication |
required. |
| https |
not required. |
| Process |
The client issue a POST request to the URI: https://g.ho.st/rest/users/{username}/session.
if there is no password or remember password cookie then it an update session cookie request. the resource checks if
there is a valid session cookie for this user and if there is the resource updated the session cookie for him. If the user has rememberPasswordCookie and these is an attribute "renew=true" sent then the resource update the session cookie. After the update the userBehaviour item of this user is updated. |
| Parameters |
username: see common parameters section
renew : boolean value set to true in case of update the session cookie and false in case of create new one. |
| Return |
HTTP header
HTTP/1.1 200 OK
The session ID will also be returned in a cookie which may be attached to subsequent requests. |
| Response body |
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
<session uid="{username}">
lFTNv54iQ5uqKDWKv28A1WDbEgk=_2008-08-18T08:23:14.979Z
</session>
</ghData>
</ghostResult>
|
| Errors |
| Unauthorized (401) |
The server failed to authorize the request.
Response HTTP header: HTTP/1.1 401
Response HTTP body
for invalid password:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="202">INVALID_PASSWORD</ghStatus>
</status>
</ghostResult>
|
| Not Found (404) |
username was not found.
Response HTTP header: HTTP/1.1 401
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="404">Not Found</httpStatus>
<ghStatus code="200">USER_NOT_FOUND</ghStatus>
</status>
</ghostResult>
|
| Internal Server Error (500) |
The server encountered an unexpected condition which prevented it from fulfilling the request
Response HTTP header: HTTP/1.1 500
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="500">Internal Server Error</httpStatus>
<ghStatus code="000">dummy code</ghStatus>
</status>
</ghostResult>
|
Delete session cookie
| Method |
DELETE |
| Action |
Delete session ookie. |
| Desc |
In the logout case a delete request to this resource will delete the user session cookie after checking if the request is authenticated . |
| Authentication |
required. |
| https |
required. |
| Process |
The client issue a DELETE request to the URI: https://g.ho.st/rest/users/{username}/session, providing the right username{username} .
The resource will check if there is a valid session cookie with the request then this cookie will be deleted. |
| Parameters |
username: see common parameters section
method = "delete". |
| Return |
HTTP header
HTTP/1.1 200 OK
The session ID will also be returned in a cookie which may be attached to subsequent requests. |
| Response body |
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
Session cookie has been deleted successfully
</ghData>
</ghostResult>
|
| Errors |
| Unauthorized (401) |
There was no valid session cookie for the user.
Response HTTP header: HTTP/1.1 401
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="210">NON_AUTHORIZED_ACCESS</ghStatus>
</status>
</ghostResult>
|
| nternal Server Error (500) |
The server encountered an unexpected condition which prevented it from fulfilling the request
Response HTTP header: HTTP/1.1 500
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="500">Internal Server Error</httpStatus>
<ghStatus code="000">dumy code</ghStatus>
</status>
</ghostResult>
|
Resource: RememberMe
Create remember password cookie
| Method |
POST |
| Action |
Creates remember password cookie. |
| Desc |
Creates remember password cookie that lasts for seven days after receiving a post request and checking if request is authenticated through session cookie or session Id.. |
| Authentication |
required. |
| https |
required. |
| Process |
The client issue a POST request to the URI: https://g.ho.st/rest/users/{username}/rememberMe, providing the right username{username} .
The server will then check the authentication of the request and if it is correct a remember password cookie (with userid, expiry date, digital signature) will be created. |
| Parameters |
username: see common parameters section |
| Return |
HTTP header
HTTP/1.1 200 OK |
| Response body |
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="200">OK</httpStatus></status>
<ghData>
<ghostCookie userId={username}>
<type>ghostcookieRememberPassword_</type>
<user>{username}</user>
<time>2008-08-10T08:21:38.422Z</time>
<id>{username}-5ff9517c-2343-44b8-8c13-3e5a933d6071</id>
<sig>qIx+E3ajhTr8GKRsWo9A+FgVfqg=</sig>
</ghostCookie>
</ghData>
</ghostResult>
|
| Errors |
| Unauthorized (401) |
The server failed to authorize the request using the password
Response HTTP header: HTTP/1.1 401
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="210">NON_UATHORIZED_ACCESS</ghStatus>
</status>
</ghostResult>
|
| Internal Server Error (500) |
The server encountered an unexpected condition which prevented it from fulfilling the request
Response HTTP header: HTTP/1.1 500
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="500">Internal Server Error</httpStatus>
<ghStatus code="000">dummy code</ghStatus>
</status>
</ghostResult>
|
Delete remember password cookie
| Method |
DELETE |
| Action |
Deletes remember password cookie. |
| Desc |
Deletes remember password cookie from the browser and the one saved in the sdb . |
| Authentication |
required. |
| https |
required. |
| Process |
The client issue a Delete request to the URI: https://g.ho.st/rest/users/{username}/rememberMe.The server will check the request authentication by checking session cookie or session Id the then deletes the remember password cookie from the browser and the sdb. |
| Parameters |
username: see common parameters section method : delete.
|
| Return |
HTTP header
HTTP/1.1 200 OK
The session ID will also be returned in a cookie which may be attached to subsequent requests. |
| Response body |
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
<user id="{username}"/>
</ghData>
</ghostResult>
|
| Errors |
| Not Found (404) |
There is no remember password cookie for this user.
Response HTTP header: HTTP/1.1 500
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="404">Not Found</httpStatus>
<ghStatus code="326">DELETE_FAILED</ghStatus>
</status>
</ghostResult>
|
| Unauthorized (401) |
The server failed to authorize the request using the cookie or the user was not found
Response HTTP header: HTTP/1.1 401
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="210">NON_UATHORIZED_ACCESS</ghStatus>
</status>
</ghostResult>
|
| Internal Server Error (500) |
The server encountered an unexpected condition which prevented it from fulfilling the request
Response HTTP header: HTTP/1.1 500
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="500">Internal Server Error</httpStatus>
<ghStatus code="000">dummy code</ghStatus>
</status>
</ghostResult>
|
Resource: Password
Change/Rest password
| Method |
PUT. |
| Action |
change or reset a password. |
| Desc |
This resource reset or change the password of a user after authenticating the request by one of two ways ; which are the the old password of the user or by a unique signature . |
| Authentication |
By checking the old password of the user if it is true then it handles the request if it is false then it is denied, if the password is not found then the signature is checked if it is true then the request is handled but if it is not true or not found then the request is denied . |
| https |
required. |
| Process |
The process depends on the parameters sent by the request, if the only parameter sent is the username then the request is reset password and here a URL with unique signature is sent to the user email when he clicks on it he will be asked to enter a new password and retype it then it will sent back with the signature to the resource where the signature will be checked and if it is true then the old password will be replaced by the new one.
The other case occurs when username, oldPassword, and newPassword are sent in this case change password process occurs where the password is checked if it belongs to the set username and there is a valid session cookie then the old password is replaced with the new one. |
| Parameters |
username: user id
oldPassword: user old password
newPassword: new selected password
signature : to authenticate reset password.
lang : language name. |
| Return |
HTTP header
HTTP/1.1 200 OK
|
| Response body |
Change password case:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="200">Ok</httpStatus>
</status>
<ghData>
<action action=change password/>
Congratulations! Your password has been changed successfully!
</action>
</ghData>
</ghostResult>
Reset password case:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="200">Ok</httpStatus>
</status>
<ghData>
<action action=reset password/>
Congratulations! Your password has been reset successfully!
</action>
</ghData>
</ghostResult>
Send reset confirmation email case:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="200">Ok</httpStatus>
</status>
<ghData>
<action action=send email/>
Confirmation email was sent to the user to authenticate reset his password
</action>
</ghData>
</ghostResult>
|
| Errors |
| Bad Request (400) |
The request could not be understood by the server due to malformed syntax
This error occurs when there is a problem in parsing either the request string or the request time.
Response HTTP header: HTTP/1.1 500
Response HTTP body
When there is an error in parsing the request string, the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="400">Bad Request</httpStatus>
<ghStatus code="232">INCOMPLETE_REQUEST</ghStatus>
</status>
</ghostResult>
|
| Unauthorized (401) |
The server failed to authorize the provided user name and password.
The username match a GhostUser in G.ho.st but there is no password, and there is an invalid remember password cookie.
Response HTTP header: HTTP/1.1 401
Response HTTP body
If the username was not found then the response body:
<ghostResult>
<status>
<httpStatus code="401">"Unauthorized"</httpStatus>
<ghStatus code="200">"USER_NOT_FOUND"</ghStatus>
</status>
</ghostResult>
If the error is due to the password:
<ghostResult>
<status>
<httpStatus code="401">"Unauthorized"</httpStatus>
<ghStatus code="202">"INVALID_PASSWORD"</ghStatus>
</status>
</ghostResult>
If the error is due to not having a session cookie :
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="210">NON_UATHORIZED_ACCESS</ghStatus>
</status>
</ghostResult>
|
| Internal Server Error (500) |
The server encountered an unexpected condition which prevented it from fulfilling the request
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult>
<status>
<httpStatus code="500">"Internal Server Error"</httpStatus>
<ghStatus code="000">"dummy code"</ghStatus>
</status>
</ghostResult>
|
Resource: ValidatePassword
Validate user password
| Method |
POST. |
| Action |
Validates user apssword. |
| Desc |
Checks if the sent password is for this user. |
| Authentication |
required. |
| https |
required. |
| Process |
The resource receives the post request holds the password then checks for the password if it is valid and send the result back to the client. |
| Parameters |
username: user id
password : user password. |
| Return |
HTTP header
HTTP/1.1 200 OK
|
| Response body |
<ghostResult>
<status>
<httpStatus code="200">Ok</httpStatus>
</status>
<ghData>
<ghData>password is valid</ghData>
</ghData>
</ghostResult>
|
| Errors |
| Bad Request (400) |
if the password wasn't sent or was wrong.
Response HTTP header: HTTP/1.1 401
Response HTTP body
if the password wasn't sent:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="400">Bad Request</httpStatus>
<ghStatus code="232">INCOMPLETE_REQUEST</ghStatus>
</status>
</ghostResult>
if the password was wrong :
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="400">Bad Request</httpStatus>
<ghStatus code="202">INVALID_PASSWORD</ghStatus>
</status>
</ghostResult>
|
| Not Found (404) |
Ghost user was not found.
Response HTTP header: HTTP/1.1 401
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="404">Not Found</httpStatus>
<ghStatus code="200">USER_NOT_FOUND</ghStatus>
</status>
</ghostResult>
|
| nternal Server Error (500) |
The server encountered an unexpected condition which prevented it from fulfilling the request
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult>
<status>
<httpStatus code="500">"Internal Server Error"</httpStatus>
<ghStatus code="000">"dummy code"</ghStatus>
</status>
</ghostResult>
|
InitialUserRsource:
| Resource |
InitialUser. |
| Desc |
This resource receives the signature that was hold by the invitation email then creates a session cookie and send back the user persistence and the user email to the client so the user so he can go on with the setup account registration. |
| Audience |
public. |
| URI |
https://g.ho.st/vcweb/rest/users/{username}/InitialUser |
| Allowed Method |
PUT. |
InitialUser
| Method |
PUT |
| Action |
Authenticates the confirmation signature then creates a session cookie and send the persistence back to the client so that the user can login to his account and continue the setup account registration. |
| Desc |
This resource receives the signature that was hold by the confirmation email then creates a session cookie and send back the user persistence and the user email to the client so the user so he can go on with the setup account registration. |
| Authentication |
This process is authenticated using a signature that is sent to the user email. |
| https |
not required. |
| Process |
This resource receives a put request from the client in the invitation registration, so the basic user information should be sent too which are the username, password, email, captcha, and the signature of the user which was created using the username and the email of the user. First step will be done is to check the captcha if it is valid then a signature is created using the sent username and email and it is compared with the sent signature if they match then a new user with this information is created and also a session cookie is created and resource get this user persistence and send it back with the user email and the referrer ghost user to the client so the user will continue with the setup account registration. If the two signatures don't match then the user will be created and a confirmation email will be sent to his new email. |
| Parameters |
username: user id
referral: user who sent the invitation.
signature.
password.
email.
captcha. |
| Return |
HTTP header
HTTP/1.1 200 OK
A session cookie will be attached to subsequent requests. |
| Response body |
<ghostResult>
<status>
<httpStatus code="200">Ok</httpStatus>
</status>
<ghData>
<action confirmation="true"/>
<username>{username}</username>
<persistence>{userPersistence}</persistence>
<email>{email}</email>
<referralGhostuse>{referralGhostUser}</referralGhostUser>
</ghData>
</ghostResult>
In the normal registration case {referralGhostUser} will be null, if "confirmation" attribute is true it means the user is confirmed. |
UserSearchResource
Search
| Method |
GET. |
| Action |
Search for the required tag or item category within the the user persistence then send the result back to the client. |
| Desc |
Search for the required tag or item category within the the user persistence then send the xml result back to the client. |
| Authentication |
required. |
| https |
not required. |
| Process |
This resource do the search according to the sent parameters after authenticating the request by checking the the validation of the user session cookie otherwise error message is sent back to the client. The parameter can be a tag, or a category, or both tag and category. In each of these cases the tag acquired can be single or multiple and the user can specify whether to get only the common items for these multiple tags or all the items related to any of them by another parameter specifying the operation. So the resource get the required parameters and search for them within the user persistence and send the xml result back to the client. |
| Parameters |
username: user id
tag: can hold single value or multiple values separated by a comma .
cat:hold the category to search for, it can hold single value.
op: holds the operation parameter for tag search case, it can be "or" or "and", the default is "and". |
| Return |
HTTP header
HTTP/1.1 200 OK
A session cookie will be attached to subsequent requests. |
| Response body |
search for tags:
<ghostResult>
<status>
<httpStatus code="200">Ok</httpStatus>
</status>
<ghData>
<GhoshItems>
<GhoshItem IsExternal="{true/false}" URI="{uri_1}">
<ItemID>{item_1 id}</ItemID>
<Category>{tag category}</Category>
<Tags><Tag>{tag name}</Tag></Tags>
</GhoshItem>
<GhoshItem IsExternal="{true/false}" URI="{uri_2}">
<ItemID>{item_2 id}</ItemID>
<Category>{tag category}</Category>
<Tags><Tag>{tag name}</Tag></Tags>
</GhoshItem>
</GhoshItems>
</ghData>
</ghostResult>
search for category or category and tags:
<ghostResult>
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
<GhoshItems>
<GhoshItem IsExternal="{true/false}" URI="{uri_1}">
<ItemID>{item_1 Id}</ItemID>
<Category>{category}</Category>
<Tags/>
</GhoshItem>
<GhoshItem IsExternal="{true/false}" URI="{uri_2}">
<ItemID>{item_2 Id}</ItemID>
<Category>{category}</Category>
<Tags/>
</GhoshItem>
</GhoshItems>
</ghData>
</ghostResult>
|
| Errors |
| Unauthorized (401) |
The server failed to authorize the provided user name and password.
The autherization is checked using first sessionId if not available session cookie is checked instead.
Response HTTP header: HTTP/1.1 401
Response HTTP body
If the username was not found then the response body:
<ghostResult>
<status>
<httpStatus code="401">"Unauthorized"</httpStatus>
<ghStatus code="210">"NON_AUTHORIZED_ACCESS"</ghStatus>
</status>
</ghostResult>
|
| Not Found (404) |
The search item is not found.
Response HTTP header: HTTP/1.1 401
Response HTTP body
If the username was not found then the response body:
<ghostResult>
<status>
<httpStatus code="404">"Not Found"</httpStatus>
<ghStatus code="006">"Bad Argument"</ghStatus>
</status>
</ghostResult>
|
| Internal Server Error (500) |
The server encountered an unexpected condition which prevented it from fulfilling the request
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult>
<status>
<httpStatus code="500">"Internal Server Error"</httpStatus>
<ghStatus code="000">"dummy code"</ghStatus>
</status>
</ghostResult>
|
IdentityResource:
Update ghost user identity
| Method |
POST. |
| Action |
Update ghost user identity. |
| Desc |
Update ghost user identity which includes title, gender,firs name, middle name, last name, birth date. And that after check request authentication using session cookie or session id.then send the new identity back in the response.
If some of these information was not sent through the request they will remain as before (only sent parameters will be updated). |
| Authentication |
In create user case the request is authenticated using the captcha while in the update case it is authenticated using the session cookie.
There is authentication in the resend confirmation email case. |
| https |
required. |
| Process |
The resource receives the post request holds the identity information that need to be updated then checks for a session id or session cookie if it is valid sent information will replace old one and ghost user will be updated. |
| Parameters |
username: see common parameters section
firstName: user first name
middleName : user middle name.
lastName : user last name.
genderId : gender id.
title : title description.
birthDate : user birth date in the form yyyy-MM-dd. |
| Return |
HTTP header
HTTP/1.1 200 OK
|
| Response body |
<ghostResult>
<status>
<httpStatus code="200">Ok</httpStatus>
</status>
<ghData>
<identity id="8452849887740343118"
title="1" titleDesc="Mr." firstName="first"
midName="mid" lastName="last" birthdate="" gender="1"/>
</ghData>
</ghostResult>
|
| Errors |
| Unauthorized (401) |
The server failed to authorize the request using sessio id or session cookie.
Response HTTP header: HTTP/1.1 401
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="210">NON_UATHORIZED_ACCESS</ghStatus>
</status>
</ghostResult>
|
| NotFound (404) |
Ghost user was not found.
Response HTTP header: HTTP/1.1 401
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="404">Not Found</httpStatus>
<ghStatus code="200">USER_NOT_FOUND</ghStatus>
</status>
</ghostResult>
|
| nternal Server Error (500) |
The server encountered an unexpected condition which prevented it from fulfilling the request
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult>
<status>
<httpStatus code="500">"Internal Server Error"</httpStatus>
<ghStatus code="000">"dummy code"</ghStatus>
</status>
</ghostResult>
|
MiscResource:
| Resource |
Misc |
| Desc |
This source updates ghost user account options and checks if ghost user isDeveloper and isModeler info. |
| Audiance |
puplic |
| URI |
https://g.ho.st/rest/users/{username}/misc. |
| Allowed Method |
POST, GET. |
Check if ghost user isDeveloper and if isModeler
| Method |
GET |
| Action |
Check if ghost user isDeveloper and if isModeler. |
| Desc |
This resource can be used to get the information of a ghost user if he is set as developer and if he is set as modeler. |
| Authentication |
required. |
| https |
not required. |
| Process |
A get request is sent to the client, the username is extracted from the URI and the resource get the user with this username. If it was not found an error message is sent back to the client otherwise the resource return a response clarifying if the user is set as developer and as modeler. |
| Parameters |
username: user id |
| Return |
HTTP header
HTTP/1.1 200 OK
|
| Response body |
If request is authorized and 'suggestion'= false:
<ghostResult>
<status>
<httpStatus code="200">Ok</httpStatus>
</status>
<ghData>
<ghostuser>
<ghUser isDeveloper="false" isModeler="true"/>
</ghostuser>
</ghData>
</ghostResult>
|
| Errors |
| Unauthorized (401) |
The server failed to authorize the request using sessio id or session cookie.
Response HTTP header: HTTP/1.1 401
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="210">NON_UATHORIZED_ACCESS</ghStatus>
</status>
</ghostResult>
|
| nternal Server Error (500) |
The server encountered an unexpected condition which prevented it from fulfilling the request
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult>
<status>
<httpStatus code="500">"Internal Server Error"</httpStatus>
<ghStatus code="000">"dummy code"</ghStatus>
</status>
</ghostResult>
|
Update ghost user account options
| Method |
POST. |
| Action |
Update ghost user account options. |
| Desc |
Update ghost user account options which includes receiveUpdates, receiveUpdatesOnGhEmail, and referral parameters. And that after check request authentication using session cookie or session id.then send the new account options back in the response.
If some of these information was not sent through the request they will remain as before (only sent parameters will be updated). |
| Authentication |
required |
| https |
not required. |
| Process |
The resource receives the post request holds the account information that need to be updated then checks for a session id or session cookie if it is valid sent information will replace old one and ghost user will be updated. |
| Parameters |
username: see common parameters section
receiveUpdates: true/false.
receiveUpdatesOnGhEmail : true/false.
referral : referral username.
includeAdult : true/false |
| Return |
HTTP header
HTTP/1.1 200 OK
|
| Response body |
<ghostResult>
<status>
<httpStatus code="200">Ok</httpStatus>
</status>
<ghData>
<AccountOptions receiveUpdates="false"
receiveUpdatesOnGhEmail="true" referrer="{referral username}"/>
</ghData>
</ghostResult>
|
| Errors |
| Unauthorized (401) |
The server failed to authorize the request using sessio id or session cookie.
Response HTTP header: HTTP/1.1 401
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="210">NON_UATHORIZED_ACCESS</ghStatus>
</status>
</ghostResult>
|
| Forbidden (403) |
referral username is the same as ghost user to be updated.
Response HTTP header: HTTP/1.1 401
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="403">Forbidden</httpStatus>
<ghStatus code="2">Validation Error</ghStatus>
</status>
</ghostResult>
|
| Internal Server Error (500) |
The server encountered an unexpected condition which prevented it from fulfilling the request
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult>
<status>
<httpStatus code="500">"Internal Server Error"</httpStatus>
<ghStatus code="000">"dummy code"</ghStatus>
</status>
</ghostResult>
|
AddressResource:
Update ghost user address
Authentication
| Method |
POST. |
| Action |
Update ghost user address. |
| Desc |
Update ghost user address which includes countryId, zip code, postal code, and state. And that after check request authentication using session cookie or session id.then send the new account options back in the response.
If some of these information was not sent through the request they will remain as before (only sent parameters will be updated). |
| required |
| https |
not required. |
| Process |
The resource receives the post request holds the address information that need to be updated then checks for a session id or session cookie if it is valid sent information will replace old one and ghost user will be updated. |
| Parameters |
username: user id
countryId : integer holds country id.
postalAddress : String holds the postal address.
city : String holds the city name.
State : string holds the state name
zip : integer holds the zip code. |
| Return |
HTTP header
HTTP/1.1 200 OK
|
| Response body |
<ghostResult>
<status>
<httpStatus code="200">Ok</httpStatus>
</status>
<ghData>
<Address addressId="0" country="226" countryDesc="United States"
city="Schenectady" state="NY" postalAddress="" zipcode="12345" addressType="1"/>
</ghData>
</ghostResult>
|
| Errors |
| Unauthorized (401) |
The server failed to authorize the request using sessio id or session cookie.
Response HTTP header: HTTP/1.1 401
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="210">NON_UATHORIZED_ACCESS</ghStatus>
</status>
</ghostResult>
|
| nternal Server Error (500) |
The server encountered an unexpected condition which prevented it from fulfilling the request
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult>
<status>
<httpStatus code="500">"Internal Server Error"</httpStatus>
<ghStatus code="000">"dummy code"</ghStatus>
</status>
</ghostResult>
|
Resource: Quota
Quota
| Method |
GET |
| Action |
Gets user quota details. |
| Desc |
This resource returns back user quota info if the request is authenticated other wise error message is sent back. |
| Authentication |
required. |
| https |
not required. |
| Process |
After receiving the Get request the resource checks if this username does exist then checks if the request is authenticated by checking the session cookie or the remember password cookie if passed then the this user info is sent back. Quota info includes basic quota, total bonus quota, promotion and invitation quota, used quota, and free quota. |
| Parameters |
username : user id |
| Response header |
HTTP header
HTTP/1.1 200 OK.
|
| Response body |
<ghostResult rev="5446">
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
<storageInfo>
<quota>5.36870912E9</quota>
<bouns>3.6952656392E10</bouns>
<total>4.2321365512E10</total>
<used>26285.0</used>
<free>4.2321339227E10</free>
<invitation>2.362232015E10</invitation>
<promotions>1.4404078066E10</promotions>
</storageInfo>
</ghData>
</ghostResult>
|
| Errors |
| Bad request (400) |
EXPIRED_SESSION_COOKIE.
Response HTTP header: HTTP/1.1 400
Response HTTP body
<ghostResult rev="5446">
<status>
<httpStatus code="400">Bad Request</httpStatus>
<ghStatus code="246">EXPIRED_SESSION_COOKIE</ghStatus>
</status>
<ghData/>
</ghostResult>
|
| Not found (404) |
User not found.
Response HTTP header: HTTP/1.1 401
Response HTTP body
<ghostResult rev="5446">
<status>
<httpStatus code="404">Not Found</httpStatus>
<ghStatus code="200">USER_NOT_FOUND</ghStatus>
</status>
<ghData/>
</ghostResult>
|
| Unauthorized (401) |
NON_UATHORIZED_ACCESS
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult rev="5446">
<status>
<htpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="210">NON_UATHORIZED_ACCESS</ghStatus>
</status>
<ghData/>
</ghostResult>
|
| Internal Server Error (500) |
Connection problem.
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult rev="5446">
<status>
<httpStatus code="500">Internal server error</httpStatus>
<ghStatus code="010">CONNECTION_PROBLEM</ghStatus>
</status>
<ghData/>
</ghostResult>
|
ContactInfoResource:
Update ghost user contactInfo
| Method |
POST. |
| Action |
Update ghost user contact info. |
| Desc |
Update ghost user contact info which includes email, webSite, homePhoneNo, workPhoneNo, mobileNo, and faxNo. And that after check request authentication using session cookie or session id.then send the new account options back in the response.
If some of these information was not sent through the request their old info will be removed. |
| Authentication |
required |
| https |
not required. |
| Process |
The resource receives the post request holds the user contact information that need to be updated then checks for a session id or session cookie if it is valid sent information will replace old one and ghost user will be updated. |
| Parameters |
username: user id
email : ghost user registartion email.
webSite : user web site.
homePhoneNo : user home phone number.
workPhoneNo : user work phone number.
mobileNo : user mobile number.
faxNo : user fax number. |
| Return |
HTTP header
HTTP/1.1 200 OK
|
| Response body |
<ghostResult>
<status>
<httpStatus code="200">Ok</httpStatus>
</status>
<ghData>
<contactMethod dayTimeId="0" dayTimeCountryCode=""
dayTimeAreaCode=""
dayTimeNumber="" mobileId="0" mobileCountryCode=""
mobileAreaCode="" mobileNumber="" webSiteId="0"
website="null" nightTimeId="0"
nightTimeCountryCode="" nightTimeAreaCode=""
nightTimeNumber="" faxId="0"
faxCountryCode="" faxAreaCode="" faxNumber=""
email="sawsanfares@yahoo.com"/>
</ghData>
</ghostResult>
|
| Errors |
| Unauthorized (401) |
The server failed to authorize the request using sessio id or session cookie.
Response HTTP header: HTTP/1.1 401
Response HTTP body
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="210">NON_UATHORIZED_ACCESS</ghStatus>
</status>
</ghostResult>
|
| Internal Server Error (500) |
The server encountered an unexpected condition which prevented it from fulfilling the request
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult>
<status>
<httpStatus code="500">"Internal Server Error"</httpStatus>
<ghStatus code="000">"dummy code"</ghStatus>
</status>
</ghostResult>
|
File URLs resource
GET for Sharing URL
| Action |
returns the url specified |
| Desc |
returns sharing page URL |
| Authentication |
required. |
| https |
not required. |
| Process |
|
| Parameters |
username: see common parameters section.
fileID : (sdb file id for Ghost FS file).
type : sharing
icon=file type according to the convention followed in Laszlo Client Example : (WebFlashVideoFileType,MSWordCompatFileType)
size: file size in bytes.
lang: language to display sharing page in.
fileName=file name .
contentType: file content type according to MIME standard |
| Return |
Sharing URL
HTTP/1.1 200 OK |
| Response body |
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
<SharingURL>
<![CDATA[http://localhost:8080/vcweb/ghostfs/ghostfs?user=shoukry&file=
sdb_xxx_xxx&sign=f2f4f6f5662684f6d4a4&icon=XXX&lang=en]]
</SharingURL>
</ghData>
</ghostResult>
|
| Errors |
For possible errors refer to [search error list] |
GET for Read URL
| Action |
returns the url specified |
| Desc |
returns a Temporary Download (File Read) URL |
| Authentication |
required. |
| https |
not required. |
| Process |
|
| Parameters |
username: user id.
fileID : (sdb file id for Ghost FS file).
type : read
|
| Return |
Read URL
HTTP/1.1 200 OK |
| Response body |
<?xml version="1.0" encoding="UTF-8"?> <ghostResult>
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
<ReadURL>
<![CDATA[http://localhost:8080/vcweb/sharing?user=shoukry&file=
sdb_xxx_xxx&sign=c526b6f55627039764e3r&ghfilename=
dono.txt&sts=a5661229504167641]]>
</ReadURL>
</ghData>
</ghostResult>
|
| Errors |
For possible errors refer to [search error list] |
GET for Write URL
| Action |
returns the url specified |
| Desc |
returns temporary write URL (upload). This might be a new file or a an existing file that has to be overridden |
| Authentication |
required. |
| https |
not required. |
| Process |
|
| Parameters |
username: see common parameters section.
fileID : (sdb file id for Ghost FS file).
type : write
OR
fileID in this case should be dummy : suggested value sdb_xxx_xxx_xxx username: see common parameters section.
folder : (sdb file id for Ghost FS folder that the new file will go into).
type : write
fileName : name of the file to be written |
| Return |
Read URL
HTTP/1.1 200 OK |
| Response body |
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
<WriteURL>
<![CDATA[http://localhost:8080/vcweb/sharing?user=
shoukry&file=sdb_xxx_xxx&sign=548462b42652f566c624w&
ghfilename=dono.txt]]>
</WriteURL>
</ghData>
</ghostResult>
OR
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
<WriteURL>
<![CDATA[http://localhost:8080/vcweb/sharing?user=
shoukry&folder=sdb_XXXX&tstamp=1229506964013&
sign=45059324a50716c6a385]]>
</WriteURL>
</ghData>
</ghostResult>
|
| Errors |
For possible errors refer to [search error list] |
GET for Download URL
| Action |
returns the url specified |
| Desc |
returns a Temporary download URL |
| Authentication |
required. |
| https |
not required. |
| Process |
|
| Parameters |
username: user id
fileID : (sdb file id for Ghost FS file).
type : download
|
| Return |
Read URL
HTTP/1.1 200 OK |
| Response body |
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
<DownloadURL>
<![CDATA[http://localhost:8080/vcweb/downloads/shoukry/
sdb_xxx_xxx/c526b6f55627039764e3r/
FKWm1229507485234/dono.txt]]>
</DownloadURL>
</ghData>
</ghostResult>
|
| Errors |
For possible errors refer to [search error list] |
TimeResource
| Resource |
Time. |
| Desc |
This resource is responsible for getting the server time. |
| Audience |
public. |
| URI |
http://g.ho.st/rest/time |
| Allowed Method |
GET. |
Time - GET
| Action |
gets the server time. |
| Desc |
getting the server time in milliseconds. |
| Authentication |
not required. |
| https |
not required. |
| Process |
getting the server time in milliseconds. |
| Parameters |
no parameters required. |
| Return |
HTTP header
HTTP/1.1 200 OK
A session cookie will be attached to subsequent requests. |
| Response body |
<ghostResult rev="5446">
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
<utcTimeInMS>1233818119768</utcTimeInMS>
</ghData>
</ghostResult>
|
| Errors |
No errors expected. |
Search FileSystem
Pagination
Current file system design supports results pagination. Pagination behvaior is supported through 2 techniques:
1. token: Any search request will returns a token as part of the response. If token is null(empty), then the search retrieved the last paged result. Else, the token can be used for the next request to get the next page. The user must use the same url(excluding parameters:startindex&pagesize) for the token to return valid results. for example:
1st Req: http://g.ho.st/vcweb/rest/users/amer/files?startindex=0&pagesize=100&query=txt&shared=true
(response will return a token in case of more results exist, token is used in the following request)
2nd Req: http://g.ho.st/vcweb/rest/users/amer/files?query=txt&shared=true&token=HJHJKFLFSKLHKTHKHTK
2. StartIndex,PageSize: those parameters combination can be used to generate paged results. The default values for these parameters are 0,200. The start index value determines the index of the results to be returned. for example:
1st Req: http://g.ho.st/vcweb/rest/users/amer/files?startindex=0&pagesize=100
2nd Req: http://g.ho.st/vcweb/rest/users/amer/files?startindex=100&pagesize=50
3rd Req: http://g.ho.st/vcweb/rest/users/amer/files?startindex=150&pagesize=50
ATTENTION: If token exists in the url, then the startindex parameter will be ignored.
Count
Search supports 'COUNT' options. if parameters 'count' is set to true, then search will return the total number of results that match the search conditions. Count search doesn't return tokens. Moreover, pagination parameters(startindex & pagesize) are ignored if supplied in the url.
Urlwill return the total number of public files that contains 'avi' string in their titles AND published after 2009-10-04. http://g.ho.st/vcweb/rest/public/files?count=true&query=avi&datepublished=2009-10-04
Search Types
Search allows different types of search to refine the results returned. These types are determined by the following parameters:private,shared,public & user.
1. private search: search user private files. can be achieved by setting 'private=true'.
2. shared search: search the files that are shared by or with user. Can be achieved by setting 'shared=true&private=true'. 'user' parameter should not be used with this type of search.
3. Shared With: search files shared with user. Can be achieved by setting 'shared=true'. 'user' parameter can be used in conjunction in order to retrieve files shared with user by a given userid. userid can be plain or hashed(user handle).
4. Shared By: search file shared by user. Can be achieved by setting 'shared=true&private=true&user=[userid]'. 'user' parameter must be added to differentiate it from shared search. 'user' value can be 'all' to get all files shared by him. else, 'user' can have the value of any other userId that the user issuing search had shared files with him.
5. public search: search public files, can be achieved by 'public=true'. User can retrieve his public files by setting 'user' parameter to 'me' or his userId.
Type & Extension
Search supports 'filetype' & 'ext' options. user can limit search over specific files types and extensions. Every type is associated with multiple files extensions. Search accepts the following types: all,document,sheet,presentation,video,audio,media,archive,application,text,images,unknown. Extensions that are allowed when coupled with different types are as follows:
video:mov,mpg,mpeg,qt,wmv,avi,3gp,mp4,swf,flv,rm,mpg
audio:aac,m3u,mid,midi,mp3,ra,ram,wav,wma
document:doc,docx,sxw,odt
presentation:ppt,pptx,pps,odp,sxi
sheet:xls,xlsx,ods,csv,sxc
text:txt,rtf
pdf:pdf
html:htm,html,xhtml
archive:zip,rar,tar,gzip,gz
image:bmp,gif,jpg,jpeg,tif,png,psd
application:exe,bat
unkown: other extensions...
Type groups includes the following:
media: audio,video
office: sheet,document,presentation
Resource: UserFileResource
| Resource |
UserFileResource |
| Desc |
this resource is responsible submitting user file search over ghost file system. User search of three types: private,shared & General search. |
| Audiance |
public. |
| URI |
http://g.ho.st/vcweb/rest/users/{username}/files |
| Allowed Method |
GET |
UserFileResource - GET
| Action |
Search File system for the user private,shared files and ghost public files |
| Desc |
This resource responsible for searching ghost drive for the user private,shared files and ghost public files. Many Advanced search options are supported to refine search results.
a. Search Private Files: Search user private (owned) undeleted files.
b. Search shared files with user: search files shared with user submitting search.
c. Search shared files by user: search files shared by user submitting search.
d. Search shared files with and by user: search private files shared by the user & files shared by others with the user submitting the search.
e. General Search: search all files that can be accessed by the user. That includes his private files, files shared with him & public shared files. |
| Authentication |
required |
| https |
not required. |
| Process |
Receives request & extract both the search query string & advanced search options. Submit search query and returns search results in response body. |
| Parameters |
Parameter (Required,Type,Default,Max): Description
1. query (optional,String): search query string from which keywords will be extracted. search will look for keywords matches in files search keywords. if query is not supplied, then search will be based on advanced conditions if available. else, search will be more like a listing of all files that are of the type of search submitted.
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=adnan%20and%20lina
Will search in user 'amer' private files based on keywords generated from query string.
ie: http://g.ho.st/vcweb/rest/users/amer/files?shared=true&private=true Will retrieve all files that are shared by or with user 'amer'.
2. startindex (optional,Integer,0): starting index of results to be returned in response body. Used for paging results. Ignored in case user supplied options like token & count.
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=my%20trip%20to%20russia&startindex=100
3. pagesize (optional,Integer,200,200): size of results to be returned in response body. Used with 'startindex' parameter to page results. ignored in case count search is requested.
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=my%20trip%20to%20russia&startindex=100&pagesize=10
4. private (optional,boolean,true): flag to set if it will search in user private shared files.
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=my%20trip%20to%20russia&private=false
5. shared (optional,boolean,false): flag to set if it will search in user shared files(with or by depending on other search parameters)
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=my%20trip%20to%20russia&shared=true
6. public (optional,boolean,false): flag to set in case of general search to include published files in search request.
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=my%20trip%20to%20russia&public=false
a. Search Private Files: private=true
b. Search shared files with user: shared=true
c. Search shared files with and by user: private=true&shared=true
d. General Search: private=true&shared=true&public=true
7. modifiedAfter (optional,Date(yyyy-MM-dd)): restrict search in files that of last modification date after the date value.
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=my%20trip%20to%20russia&modifiedAfter=2005-05-18
8. modifiedbefore (optional,Date(yyyy-MM-dd)): restrict search in files that of last modification date before the date value.
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=my%20trip%20to%20russia&modifiedbefore=2005-05-18
9. creationdatefrom (optional,Date(yyyy-MM-dd)): restrict search in files that were created after the date value
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=my%20trip%20to%20russia&creationdatefrom=2005-05-18
10. creationdateto (optional,Date(yyyy-MM-dd)): restrict search in files that were created before the date value
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=my%20trip%20to%20russia&creationdateto=2008-06-18
11. sortby (optional,String): sort results by the supplied atrribute, the supported list are:[datemodified,rating, and viewed [it-11]]
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=my%20trip%20to%20russia&sortby=datemodified
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=my%20trip%20to%20russia&sortby=rating
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=my%20trip%20to%20russia&sortby=viewed
12. count (optional,String,false): flag to set if user is submitting a count search to count the number of files match by the search parameters. the flag is turned on only and only if its value is 'true'
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=txt&shared=true&count=true.
13. token (optional,String,null): Token string returned from previous search request. Token is used to bring next paged results.
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=txt&shared=true&token=HKGLHKGFLSALGGMHHMG
14. read (optional,String): parameter used in combination with sharedWith search. Takes two values (true,false). if true returns the read shared files with user submitting search, else it returns unread files. if doesn't exist, all files are returned.
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=txt&shared=true&read=false
15. user (optional,String(Id/Handle)): this attribute in conjunction with shared(sharedWith & sharedBy)& public file search. For proper user. Please read the 'search types' section above.
ie: http://g.ho.st/vcweb/rest/users/yazan.ghandour/files?method=GET&shared=true&private=true&pagesize=40&user=all
ie: http://g.ho.st/vcweb/rest/users/amer.mani/files?method=GET&shared=true&pagesize=40&user=salah
ie: http://g.ho.st/vcweb/rest/users/amer.mani/files?method=GET&public=true&user=me
16. filetype (optional,String,files): restrict search over files of the following types: [all,document,sheet,presentation,video,audio,media,archive,application,text,images,unknown]
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=my%20trip%20to%20russia&filetype=video
17. ext (optional,String): extension follows the file type selected. if filetype is images, then the possible values are the following: [any,jpg,png,bmp,gif]
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=my%20trip%20to%20russia&filetype=images&ext=jpg
The following parameters are not supported yet:
18. minsize (optional,Integer,0): restrict search over files of size greater than size value.
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=my%20trip%20to%20russia&minsize=1000
19. maxsize (optional,Integer,0): restrict search over files of size loss than size value.
ie: http://g.ho.st/vcweb/rest/users/amer/files?query=my%20trip%20to%20russia&maxsize=500000
|
| Return |
HTTP header
HTTP/1.1 200 OK
|
| Count Response body |
<ghostResult rev="5446">
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
<SearchResult results="5">
<GhostFiles/>
</SearchResult>
</ghData>
</ghostResult>
|
| Result Response body |
Response will return two types of urls:
1. Private url: in case the user submitting the search is the OWNER of the resource:
i.e:http://server.g.ho.st/vcweb/dav/users/sara/files/GhostFileSystem/sara/@ById/SDB_358f15f8-4eab-4c4c-97c4-0da19f35a326
2. Shared(hashed) url: in case the resource is shared with the user submitting the search OR the file is a public file(General Search)
i.e http://server.g.ho.st/vcweb/dav/users/sara/files/GhostFileSystem/~BC290AB493F418C0/@ById/SDB_215c8572-ed26-4933-b934-ab801894a881
<ghostResult rev="5446">
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
<SearchResult hasMore="true" results="4" startIndex="0"
token="rO0ABXNyACdjb20uYW1hem9uLnNkcy5RdWVyeVByb2Nlc3Nvci5Nb3JlVG">
<GhostFiles>
<D:multistatus>
<D:response>
<D:href>
http://server.g.ho.st/vcweb/dav/users/sara
/files/GhostFileSystem/~BC290AB493F418C0/
@ById/SDB_215c8572-ed26-4933-b934-ab801894a881
</D:href>
<D:propstat>
<D:prop>
<D:displayname>sharedWith Sara 2.txt</D:displayname>
<G:_Name>sharedWith Sara 2.txt</G:_Name>
<D:resourcetype/>
<G:_IsFolder>false</G:_IsFolder>
<D:getcontenttype>text/plain</D:getcontenttype>
<G:_ContentType>text/plain</G:_ContentType>
<G:access>sara#0#2009-04-22T08:52:16.526Z#1</G:access>
<G:_S3ObjectKey>S3_40afdd2f-e25c-4412-bdd6-022815228606</G:_S3ObjectKey>
<D:getetag>W/"01240390254105"</D:getetag>
<D:getlastmodified>Wed, 22 Apr 2009 08:50:54 GMT</D:getlastmodified>
<G:_DateModified>2009-04-22T08:50:54.105Z</G:_DateModified>
<D:getcontentlength>0</D:getcontentlength>
<G:_Size>0</G:_Size>
<G:owner>~BC290AB493F418C0</G:owner>
<D:creationdate>2009-04-22T08:50:54Z</D:creationdate>
<G:_DateCreated>2009-04-22T08:50:54.105Z</G:_DateCreated>
<D:getcontentlanguage>english</D:getcontentlanguage>
<G:resourceid>SDB_215c8572-ed26-4933-b934-ab801894a881</G:resourceid>
<G:Id>SDB_215c8572-ed26-4933-b934-ab801894a881</G:Id>
<G:_NameLowercase>sharedwith sara 2.txt</G:_NameLowercase>
<G:urlfor>sara</G:urlfor>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
<D:response>
<D:href>
http://server.g.ho.st/vcweb/dav
/users/sara/files/GhostFileSystem
/sara/@ById/SDB_358f15f8-4eab-4c4c-97c4-0da19f35a326
</D:href>
<D:propstat>
<D:prop>
<D:displayname>share with sasha 1.txt</D:displayname>
<G:_Name>share with sasha 1.txt</G:_Name>
<D:resourcetype/>
<G:_IsFolder>false</G:_IsFolder>
<D:getcontenttype>text/plain</D:getcontenttype>
<G:_ContentType>text/plain</G:_ContentType>
<G:access>sara#O#2009-04-22T08:55:24.313Z</G:access>
<G:_S3ObjectKey>S3_518efe9b-c587-47e2-9022-100eff2e6dca</G:_S3ObjectKey>
<D:getetag>W/"01240390472400"</D:getetag>
<D:getlastmodified>Wed, 22 Apr 2009 08:54:32 GMT</D:getlastmodified>
<G:_DateModified>2009-04-22T08:54:32.400Z</G:_DateModified>
<D:getcontentlength>0</D:getcontentlength>
<G:_Size>0</G:_Size> <G:owner>sara</G:owner>
<D:creationdate>2009-04-22T08:54:32Z</D:creationdate>
<G:_DateCreated>2009-04-22T08:54:32.400Z</G:_DateCreated>
<D:getcontentlanguage>english</D:getcontentlanguage>
<G:resourceid>SDB_358f15f8-4eab-4c4c-97c4-0da19f35a326</G:resourceid>
<G:Id>SDB_358f15f8-4eab-4c4c-97c4-0da19f35a326</G:Id>
<G:_NameLowercase>share with sasha 1.txt</G:_NameLowercase>
<G:urlfor>sara</G:urlfor>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
<D:response>
<D:href>
http://server.g.ho.st/vcweb/dav/users
/sara/files/GhostFileSystem
/~BC290AB493F418C0/@ById/SDB_75c81457-7a2a-4f77-b44d-87679f3038c3
</D:href>
<D:propstat>
<D:prop>
<D:displayname>shareWith Sara 3.txt</D:displayname>
<G:_Name>shareWith Sara 3.txt</G:_Name>
<D:resourcetype/>
<G:_IsFolder>false</G:_IsFolder>
<D:getcontenttype>text/plain</D:getcontenttype>
<G:_ContentType>text/plain</G:_ContentType>
<G:access>sara#0#2009-04-22T08:52:31.671Z#1</G:access>
<G:_S3ObjectKey>S3_bba3866f-e64f-4691-bf34-8e486dc0f6c3</G:_S3ObjectKey>
<D:getetag>W/"01240390268288"</D:getetag>
<D:getlastmodified>Wed, 22 Apr 2009 08:51:08 GMT</D:getlastmodified>
<G:_DateModified>2009-04-22T08:51:08.288Z</G:_DateModified>
<D:getcontentlength>0</D:getcontentlength>
<G:_Size>0</G:_Size>
<G:owner>~BC290AB493F418C0</G:owner>
<D:creationdate>2009-04-22T08:51:08Z</D:creationdate>
<G:_DateCreated>2009-04-22T08:51:08.288Z</G:_DateCreated>
<D:getcontentlanguage>english</D:getcontentlanguage>
<G:resourceid>SDB_75c81457-7a2a-4f77-b44d-87679f3038c3</G:resourceid>
<G:Id>SDB_75c81457-7a2a-4f77-b44d-87679f3038c3</G:Id>
<G:_NameLowercase>sharewith sara 3.txt</G:_NameLowercase>
<G:urlfor>sara</G:urlfor>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
</D:multistatus>
</GhostFiles>
</SearchResult>
</ghData>
</ghostResult>
|
| Errors |
| Bad Request (400) |
The request could not be understood by the server due to malformed syntax
This error occurs when there is a problem in parsing either the request string or due to invalid values for search conditions or search string
Response HTTP header: HTTP/1.1 500
Response HTTP body
When there is an error in the query string submitted, the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="400">Bad Request</httpStatus>
<ghStatus code="802">INVALID_QUERY_STRING</ghStatus>
</status>
</ghostResult>
Response HTTP body
When there is an error in a search condition parameter value, the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="400">Bad Request</httpStatus>
<ghStatus code="803">INVALID_SEARCH_CONDITON_VALUE</ghStatus>
</status>
</ghostResult>
Response HTTP body
When there is an error in the query string submitted, the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="400">Bad Request</httpStatus>
<ghStatus code="804">UNSUPPORTED_SEARCH_CONDTION_VALUE</ghStatus>
</status>
</ghostResult>
Response HTTP body
When there is an error in the execution of search operation (invalid search operation setting), the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="400">Bad Request</httpStatus>
<ghStatus code="801">INVALID_SEARCH_OPERATION</ghStatus>
</status>
</ghostResult>
Response HTTP body
When there is an error in the the combination of search conditions (for example: public=true), the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult rev="5446">
<status>
<httpStatus code="400">Bad Request</httpStatus>
<ghStatus code="805">INVALID_SEARCH_CONDITION_COMBINATION</ghStatus>
</status>
<ghData/>
</ghostResult>
|
| Unauthorized (401) |
The server failed to authorize the provided user name and password.
The username match a GhostUser in G.ho.st but there is no password, and there is an invalid remember password cookie.
Response HTTP header: HTTP/1.1 401
Response HTTP body
If the username was not found then the response body:
<ghostResult>
<status>
<httpStatus code="401">"Unauthorized"</httpStatus>
<ghStatus code="200">"USER_NOT_FOUND"</ghStatus>
</status>
</ghostResult>
<ghostResp>
If the error is due to the password:
<ghostResult>
<status>
<httpStatus code="401">"Unauthorized"</httpStatus>
<ghStatus code="202">"INVALID_PASSWORD"</ghStatus>
</status>
</ghostResult>
If the error is due to not having a session cookie :
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="210">NON_UATHORIZED_ACCESS</ghStatus>
</status>
</ghostResult>
|
| Internal Server Error (500) |
The server encountered an unexpected condition which prevented it from fulfilling the request
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult>
<status>
<httpStatus code="500">"Internal Server Error"</httpStatus>
<ghStatus code="800">"SEARCH_OPERATION_FAILED"</ghStatus>
</status>
</ghostResult>
|
| service not available (503) |
Service not available
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult>
<status>
<httpStatus code="503">"SERVER_ERROR_SERVICE_UNAVAILABLE"</httpStatus>
<ghStatus code="702">"SERVICE_NOT_AVAILABLE"</ghStatus>
</status>
</ghostResult>
|
Resource: PublicFilesResource
| Resource |
UserFileResource |
| Desc |
this resource is responsible submitting user file search over published files in ghost file system. |
| Audiance |
public. |
| URI |
http://g.ho.st/vcweb/rest/public/files |
| Allowed Method |
GET |
PublicFilesResource - GET
| Action |
Search File system for ghost public files |
| Desc |
This resource responsible for searching ghost drive for public shared files. It allows advanced search options to refine search by setting a group of advanced search conditions |
| Authentication |
not required |
| https |
not required. |
| Process |
Receives request & extract both the search query string & advanced search options. Submit search query and returns search results in response body. |
| Parameters |
Parameter (Required,Type,Default,Max): Description
1. query (optional,String): search query string from which keywords will be extracted. search will look for keywords matches in files search keywords. if query is not supplied, then search will be based on advanced conditions if available. else, search will be more like a listing of all published files.
ie: http://g.ho.st/vcweb/rest/public/files?query=adnan%20and%20lina
Will search in published e files based on keywords generated from query string. ie: http://g.ho.st/vcweb/rest/public/files Will retrieve all files that are published (default page size)
2. startindex (optional,Integer,0): starting index of results to be returned in response body. Used for paging results. Ignored in case options like token & count.
ie: http://g.ho.st/vcweb/rest/public/files?query=my%20trip%20to%20russia&startindex=100
3. pagesize (optional,Integer,200,200): size of results to be returned in response body. Used with 'startindex' parameter to page results. ignored in case 'count' search is requested.
ie: http://g.ho.st/vcweb/rest/public/files?query=my%20trip%20to%20russia&startindex=100&pagesize=10
4. modifiedAfter (optional,Date(yyyy-MM-dd)): restrict search in files that of last modification date after the date value.
ie: http://g.ho.st/vcweb/rest/public/files?query=my%20trip%20to%20russia&modifiedAfter=2005-05-18
5. modifiedbefore (optional,Date(yyyy-MM-dd)): restrict search in files that of last modification date before the date value.
ie: http://g.ho.st/vcweb/rest/public/files?query=my%20trip%20to%20russia&modifiedbefore=2005-05-18
6. creationdatefrom (optional,Date(yyyy-MM-dd)): restrict search in files that were created after the date value
ie: http://g.ho.st/vcweb/rest/public/files?query=my%20trip%20to%20russia&creationdatefrom=2005-05-18
7. creationdateto (optional,Date(yyyy-MM-dd)): restrict search in files that were created before the date value
ie: http://g.ho.st/vcweb/rest/public/files?query=my%20trip%20to%20russia&creationdateto=2008-06-18
8. sortby (optional,String): sort results by the supplied atrribute, the supported list are:[datepublished]
ie: http://g.ho.st/vcweb/rest/public/files?query=my%20trip%20to%20russia&sortby=datemodified
9. count (optional,String,false): flag to set if user is submitting a count search to count the number of files match by the search parameters. the flag is turned on only and only if its value is 'true'
ie: http://g.ho.st/vcweb/rest/public/files?query=avi&count=true.
10. token (optional,String,null): Token string returned from previous search request. Token is used to bring next paged results.
ie: http://g.ho.st/vcweb/rest/public/files?query=txt&token=HKGLHKGFLSALGGMHHMG
11. datepublished (optional,Date(yyyy-MM-dd)): restricts search in public files that were published after the date value
ie: http://g.ho.st/vcweb/rest/public/files?query=my%20trip%20to%20russia&datepublished=2009-10-04
12. filetype (optional,String,files): restrict search over files of the following types: [all,document,sheet,presentation,video,audio,media,archive,application,text,images,unknown]
ie: http://g.ho.st/vcweb/rest/rest/public/files?query=my%20trip%20to%20russia&filetype=all
13. ext (optional,String): extension follows the file type selected. if filetype is images, then the possible values are the following: [any,jpg,png,bmp,gif]
ie: http://g.ho.st/vcweb/rest/rest/public/files?query=my%20trip%20to%20russia&filetype=images&ext=jpg
14. filter (optional,String): filters content that is marked according to the filter value. Allowed filter options are:adult
ie: http://g.ho.st/vcweb/rest/rest/public/files?query=pornograpic&filter=adult
The following parameters are not supported yet:
15. minsize (optional,Integer,0): restrict search over files of size greater than size value.
ie: http://g.ho.st/vcweb/rest/rest/public/files?query=my%20trip%20to%20russia&minsize=1000
16. maxsize (optional,Integer,0): restrict search over files of size loss than size value.
ie: http://g.ho.st/vcweb/rest/rest/public/files?query=my%20trip%20to%20russia&maxsize=500000
|
| Return |
HTTP header
HTTP/1.1 200 OK
|
| Count Response body |
<ghostResult rev="5446">
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
<SearchResult results="252">
<GhostFiles/>
</SearchResult>
</ghData>
</ghostResult>
|
| Response body |
<ghostResult rev="5446">
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
<SearchResult hasMore="true" results="2" startIndex="0"
token="rO0ABXNyACdjb20uYW1hem9uLnNkcy5RdWVyeVByb2Nlc3Nvci5Nb3JlVG9rZW7racXLnINNqwMA">
<GhostFiles>
<D:multistatus>
<D:response>
<D:href>
http://server.g.ho.st/vcweb/dav/users/public@ghost/files
/GhostFileSystem/~BA23A73DBF95D8DE/@ById
/SDB_699cff30-4d18-4647-b2c1-adbb07e37450
</D:href>
<D:propstat>
<D:prop>
<D:displayname>ShareMe.txt8487</D:displayname>
<G:_Name>ShareMe.txt8487</G:_Name>
<G:_dateMadePublic>2009-03-05T11:30:57.392Z</G:_dateMadePublic>
<D:resourcetype/>
<G:_IsFolder>false</G:_IsFolder>
<G:access>public@ghost#2009-03-05T11:30:57.392Z#1</G:access>
<G:_S3ObjectKey>S3_efc757ca-9465-439c-90e9-7b36004cc42b</G:_S3ObjectKey>
<D:getetag>W/"141236252657392"</D:getetag>
<D:getlastmodified>Thu, 05 Mar 2009 11:30:57 GMT</D:getlastmodified>
<G:_DateModified>2009-03-05T11:30:57.392Z</G:_DateModified>
<D:getcontentlength>14</D:getcontentlength>
<G:_Size>14</G:_Size>
<G:owner>~BA23A73DBF95D8DE</G:owner>
<D:creationdate>2009-03-05T11:30:26Z</D:creationdate>
<G:_DateCreated>2009-03-05T11:30:26.771Z</G:_DateCreated>
<D:getcontentlanguage>english</D:getcontentlanguage>
<G:resourceid>SDB_699cff30-4d18-4647-b2c1-adbb07e37450</G:resourceid>
<G:Id>SDB_699cff30-4d18-4647-b2c1-adbb07e37450</G:Id>
<G:_NameLowercase>shareme.txt8487</G:_NameLowercase>
<G:urlfor>public@ghost</G:urlfor>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
<D:response>
<D:href>
http://server.g.ho.st/vcweb/dav/users/public@ghost/files
/GhostFileSystem/~914CF87ABEE8ECCAB3A72343418C62B6BA1C6D376CC83B52
/@ById/SDB_8ed00158-b0c8-406a-a371-8723257ae19f
</D:href>
<D:propstat>
<D:prop>
<D:displayname>fileName0_user0_1236517076400</D:displayname>
<G:_Name>fileName0_user0_1236517076400</G:_Name>
<G:_dateMadePublic>2009-03-08T12:59:26.848Z</G:_dateMadePublic>
<D:resourcetype/>
<G:access>public@ghost#2009-03-08T12:59:26.848Z#1</G:access>
<G:_S3ObjectKey>S3_e5441670-622d-41b8-aafb-9c7dc9641bf5</G:_S3ObjectKey>
<D:getetag>W/"01236517166848"</D:getetag>
<D:getlastmodified>Sun, 08 Mar 2009 12:59:26 GMT</D:getlastmodified>
<G:_DateModified>2009-03-08T12:59:26.848Z</G:_DateModified>
<D:getcontentlength>0</D:getcontentlength>
<G:_Size>0</G:_Size>
<G:owner>~914CF87ABEE8ECCAB3A72343418C62B6BA1C6D376CC83B52</G:owner>
<D:creationdate>2009-03-08T12:59:24Z</D:creationdate>
<G:_DateCreated>2009-03-08T12:59:24.518Z</G:_DateCreated>
<D:getcontentlanguage>english</D:getcontentlanguage>
<G:resourceid>SDB_8ed00158-b0c8-406a-a371-8723257ae19f</G:resourceid>
<G:Id>SDB_8ed00158-b0c8-406a-a371-8723257ae19f</G:Id>
<G:_NameLowercase>filename0_user0_1236517076400</G:_NameLowercase>
<G:urlfor>public@ghost</G:urlfor>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
</D:multistatus>
</GhostFiles>
</SearchResult>
</ghData>
</ghostResult>
|
| Errors |
| Bad Request (400) |
The request could not be understood by the server due to malformed syntax
This error occurs when there is a problem in parsing either the request string or due to invalid values for search conditions or search string
Response HTTP header: HTTP/1.1 500
Response HTTP body
When there is an error in the query string submitted, the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="400">Bad Request</httpStatus>
<ghStatus code="802">INVALID_QUERY_STRING</ghStatus>
</status>
</ghostResult>
Response HTTP body
When there is an error in a search condition parameter value, the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="400">Bad Request</httpStatus>
<ghStatus code="803">INVALID_SEARCH_CONDITON_VALUE</ghStatus>
</status>
</ghostResult>
Response HTTP body
When there is an error in the query string submitted, the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="400">Bad Request</httpStatus>
<ghStatus code="804">UNSUPPORTED_SEARCH_CONDTION_VALUE</ghStatus>
</status>
</ghostResult>
Response HTTP body
When there is an error in the execution of search operation (invalid search operation setting), the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="400">Bad Request</httpStatus>
<ghStatus code="801">INVALID_SEARCH_OPERATION</ghStatus>
</status>
</ghostResult>
Response HTTP body
When there is an error in the the combination of search conditions, the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult rev="5446">
<status>
<httpStatus code="400">Bad Request</httpStatus>
<ghStatus code="805">INVALID_SEARCH_CONDITION_COMBINATION</ghStatus>
</status>
<ghData/>
</ghostResult>
|
| Internal Server Error (500) |
The server encountered an unexpected condition which prevented it from fulfilling the request
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult>
<status>
<httpStatus code="500">"Internal Server Error"</httpStatus>
<ghStatus code="800">"SEARCH_OPERATION_FAILED"</ghStatus>
</status>
</ghostResult>
|
| service not available (503) |
Service not available
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult>
<status>
<httpStatus code="503">"SERVER_ERROR_SERVICE_UNAVAILABLE"</httpStatus>
<ghStatus code="702">"SERVICE_NOT_AVAILABLE"</ghStatus>
</status>
</ghostResult>
|
Resource: CommentingPublicFilesResource
CommentingPublicFilesResource - GET
| Action |
Loads all the comments on the public files |
| Desc |
Loads all the comments on the puvlic files, this comments are submitted by the users. |
| Authentication |
not required |
| https |
not required. |
| Process |
Receives request & extract both the file id from the url. execute the query and returns the results in response body. |
| Parameters |
No Parameters in the get |
| Return |
HTTP header
HTTP/1.1 200 OK
|
| Response body |
<ghostResult rev="5446">
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
<comments fileId="SDB_f7d2cf05-686a-4657-a30c-f90f33a00588">
<comment contributor="yazan abdel karim Ghandour"
time="2009-06-18T10:00:47Z"
commentId="fab90632-a77d-48b2-b51d-bd86a035e26e">nice one</comment>
<comment contributor="mustafa tirhi" time="2009-06-12T10:00:47Z"
commentId="fab92130632-a77d-48b2-b51d-bd86a035e26e">i like it</comment>
</comments>
</ghData>
</ghostResult>
fileId : The resource id.
contributor: the full name of the submitter.
commentId : the id of the comment on the sdb. |
| Errors |
| Bad Request (400) |
The request could not be understood by the server due to malformed syntax
This error occurs when there is a problem in parsing either the request string or due to invalid values for search conditions or search string
Response HTTP header: HTTP/1.1 500
|
| Internal Server Error (500) |
The server encountered an unexpected condition which prevented it from fulfilling the request
Response HTTP header: HTTP/1.1 500
|
CommentingPublicFilesResource - POST
| Action |
Submit new comment on the a specific public file |
| Desc |
This resource responsible for submmiting new comments on any public file |
| Authentication |
required |
| Captcha |
required |
| https |
not required. |
| Process |
Receives request & extract all the parameters, then add new comment on the file, also increase the number of comments on the file system |
| Parameters |
Parameter (Required,Type,Default,Max): Description
ie: http://g.ho.st/vcweb/rest/public/files/SDB_f7d2cf05-686a-4657-a30c-f90f33a00588/comments?method=post&userId=yazan.ghandour&comment=nice%20one&captcha=e242b
1. comment (String): the comment that the user sumbmited.
ie: I like it, i hate it...etc
2. userId (String): the user id of the user that wants to submit a new comment.
3. captcha (String): The user should send a valid captcha [1]
|
| Return |
HTTP header
HTTP/1.1 200 OK
|
| Count Response body |
<ghostResult rev="5446">
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>
<comment numComments="3">
The comment [ i love it ] has been added successfully
</comment>
</ghostResult>
|
| Errors |
| Bad Request (400) |
The request could not be understood by the server due to malformed syntax
This error occurs when there is a problem in parsing either the request strings
Response HTTP header: HTTP/1.1 500
Response HTTP body
When there is an error in captcah , the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="403">Forbidden</httpStatus>
<ghStatus code="234">ERROR_IN_CAPTCHA</ghStatus>
</status>
</ghostResult>
Response HTTP body
When the public file is not found, the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="404">Not Found</httpStatus>
<ghStatus code="300">The file [SDB_f7d2cf05-686a-4657-a30c-f90f33ass00588]
that the user [yazan.ghandour] tried to add a comment on it is not found
</ghStatus>
</status>
</ghostResult>
Response HTTP body
When the resource is not public file, the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="403">Forbidden</httpStatus>
<ghStatus code="324">
The file [SDB_3c81bb22-3979-4aac-a459-4fd28a9e4cf5] that the user
[yazan.ghandour] tried to add a comment on it is not a public file
</ghStatus>
</status>
</ghostResult>
|
| Internal Server Error (500) |
The server encountered an unexpected action
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult>
<status>
<httpStatus code="500">"Internal Server Error"</httpStatus>
<ghStatus code="800">"SEARCH_OPERATION_FAILED"</ghStatus>
</status>
</ghostResult>
|
| service not available (503) |
Service not available
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult>
<status>
<httpStatus code="503">
"SERVER_ERROR_SERVICE_UNAVAILABLE"
</httpStatus>
<ghStatus code="702">"SERVICE_NOT_AVAILABLE"</ghStatus>
</status>
</ghostResult>
|
Resource: CommentingPublicFilesResource (2)
CommentingPublicFilesResource - DELETE
| Action |
Delete the comment. |
| Desc |
This resource is also responsible for deleting any comment on any public file, the user should be admin to do this action. |
| Authentication |
required |
| ADMIN |
required |
| https |
not required. |
| Process |
Receives request & extract all the parameters, check the auth, and if the user is an admin or not. then delete the comment and decrease the number of comments counter. |
| Parameters |
Parameter (Required,Type,Default,Max): Description
ie:http://local.testghost.com:8080/vcweb/rest/public/files/SDB_0143dd01-13be-461e-aabf-a3961a19f4a4/comments/{63222ffe-fe1e-4a28-9760-3e5674622fff?method=delete&userId=user24
1. userId (String): the user id of the user that wants to submit a new comment.
|
| Return |
HTTP header
HTTP/1.1 200 OK
|
| Response body |
<ghostResult rev="5446">
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData>The message has been deleted sucessfully</ghData>
</ghostResult>
|
| Errors |
| Bad Request (400) |
The request could not be understood by the server due to malformed syntax
This error occurs when there is a problem in parsing either the request strings
Response HTTP body
When the public file is not found, the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="404">Not Found</httpStatus>
<ghStatus code="300">
The file [SDB_f7d2cf05-686a-4657-a30c-f90f33ass00588]
that the user [yazan.ghandour] tried to add a comment on it is not found
</ghStatus>
</status>
</ghostResult>
Response HTTP body
When the resource is not public file, the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="403">Forbidden</httpStatus>
<ghStatus code="324">
The file [SDB_3c81bb22-3979-4aac-a459-4fd28a9e4cf5] that the user [yazan.ghandour]
tried to add a comment on it is not a public file
</ghStatus>
</status>
</ghostResult>
|
| Internal Server Error (500) |
The server encountered an unexpected action
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult>
<status>
<httpStatus code="500">"Internal Server Error"</httpStatus>
<ghStatus code="800">"SEARCH_OPERATION_FAILED"</ghStatus>
</status>
</ghostResult>
|
| service not available (503) |
Service not available
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult>
<status>
<httpStatus code="503">"SERVER_ERROR_SERVICE_UNAVAILABLE"</httpStatus>
<ghStatus code="702">"SERVICE_NOT_AVAILABLE"</ghStatus>
</status>
</ghostResult>
|
Resource: RatingPublicFilesResource
RatingPublicFilesResource - POST
| Action |
Give a rate for any public file. |
| Desc |
This resource responsible for saving the rates. Its forbidden to do the rate more than once per user. |
| Authentication |
required |
| https |
not required. |
| Process |
Receives request & extract all the parameters, then add the rate on the file, also measure the average rating.for every file, the user can do the rate once. |
| Parameters |
Parameter (Required,Type,Default,Max): Description
ie: http://g.ho.st/vcweb/rest/public/files/SDB_f7d2cf05-686a-4657-a30c-f90f33a00588/ratings?userId=yazan.ghandour&rating=4
1. ratings (String): the value of the rating. It should be 1,2,3,4,5
2. userId (String): the user id of the user that wants to rate the file |
| Return |
HTTP header
HTTP/1.1 200 OK
|
| Count Response body |
<ghostResult rev="5446">
<status>
<httpStatus code="200">OK</httpStatus>
</status>
<ghData
<rate rating="1.3"
numRatings="4">The rate [ 3 ] has been done successfully
</rate>
</ghData>
</ghostResult>
|
| Errors |
| Bad Request (400) |
The request could not be understood by the server due to malformed syntax
This error occurs when there is a problem in parsing either the request strings
Response HTTP header: HTTP/1.1 500
Response HTTP body
When the user is not authorized , the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?> <ghostResult>
<status>
<httpStatus code="401">Unauthorized</httpStatus>
<ghStatus code="210">The user is unauthorized to do the action</ghStatus>
</status>
<ghData>
The user [yazan.ghandour ]
that tried to access the file [SDB_f7d2cf05-686a-4657-a30c-f90f33a00588]
is not authorized
</ghData>
</ghostResult>
Response HTTP header: HTTP/1.1 500
Response HTTP body
When the user is already voted , the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="403">Forbidden</httpStatus>
<ghStatus code="501">
The user [yazan.ghandour ] is already voted on this resource :
[SDB_f7d2cf05-686a-4657-a30c-f90f33a00588]
</ghStatus>
</status> </ghostResult>
Response HTTP body
When the public file is not found, the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="404">Not Found</httpStatus>
<ghStatus code="300">
The file [SDB_f7d2cf05-686a-4657-a30c-f90f33ass00588]
that the user [yazan.ghandour] tried to rate it is not found
</ghStatus>
</status>
</ghostResult>
Response HTTP body
When the resource is not public file, the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="403">Forbidden</httpStatus>
<ghStatus code="324">
The file [SDB_3c81bb22-3979-4aac-a459-4fd28a9e4cf5]
that the user [yazan.ghandour] tried to rate on it
is not a public file
</ghStatus>
</status>
</ghostResult>
Response HTTP body
When the user is trying to rate with invalid rate value [not 1-5], the result body looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<ghostResult>
<status>
<httpStatus code="400">Bad Request</httpStatus>
<ghStatus code="503">
The user[user16] is trying to rate the resource
[SDB_f7d2cf05-686a-4657-a30c-f90f33a00588]
with [9] value, the value should be 1,2,3,4,5
</ghStatus>
</status>
</ghostResult>
|
| Internal Server Error (500) |
The server encountered an unexpected action
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult>
<status>
<httpStatus code="500">"Internal Server Error"</httpStatus>
<ghStatus code="800">"SEARCH_OPERATION_FAILED"</ghStatus>
</status>
</ghostResult>
|
| service not available (503) |
Service not available
Response HTTP header: HTTP/1.1 500
Response HTTP body
<ghostResult>
<status>
<httpStatus code="503">"SERVER_ERROR_SERVICE_UNAVAILABLE"</httpStatus>
<ghStatus code="702">"SERVICE_NOT_AVAILABLE"</ghStatus>
</status>
</ghostResult> |
|
|