This page provides a quick overview of the steps required to use SpreadSheetSpace REST API.
						An active SpreadSheetSpace user account is mandatory to use REST APIs. You can register a new account for free here.
						
						Your app must provide a valid authentication token (*see #2 below to find out how to get one) in each request, through an HTTP header:
					
token: <A_VALID_AUTHENTICATION_TOKEN>
					...or alternatively your app must provides user credentials in each request, through the following HTTP header:
username: <YOUR_SPREADSHEETSPACE_USERNAME>
					password: <YOUR_SPREADSHEETSPACE_PASSWORD>
					
						In order to use SpreadSheetSpace REST APIs (and the SpreadSheetSpace SDK in general) your user account must have the Sync service enabled.
						
						You can enable Sync for a specific account by logging in to the SpreadSheetSpace web interface and navigating to the Preferences page.
						
						
						Once enabled the Sync service, from the Preferences page you can also generate new authentication tokens and manage existing ones.
						
						Authentication tokens are useful so you don't have to provide your user credentials to every application.
					
Once your app/user is authorized, it can make requests to the SpreadSheetSpace platform. A request URL includes these components:
/getContacts)You can find a sample code below (click on the available language to expand full code block):
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class APITester {
	/* SPREADSHEETSPACE REST API REQUIRED INFORMATIONS */
	// SpreadSheetSpace REST API root URL (Change this with your SpreadSheetSpace server API URL if you have purchased an OnPremises installation)
	private static final String SPREADSHEETSPACE_API_URL = " recipients = new LinkedList();
		recipients.add(VIEW_RECIPIENT);
		Gson gson = new Gson();
		try {
			HttpResponse postResponse = null;
			// Repeat SpreadSheetSpace View creation/update cycle UPDATE_TIMES times
			for (int i = 0; i < UPDATE_TIMES; i++) {
				// Generate random View data table
				String[][] data = generateRandomData(rows, cols); 
				if (viewId == null || viewServer == null) {
					// No SpreadSheetSpace View has already been created ==> Create a new SpreadSheetSpace View
					System.out.println("Creating new SpreadSheetSpace View: " + viewDescription);
					// Initialize HTTP POST request using createPrivateView REST API URL
					HttpPost postRequest = new HttpPost(SPREADSHEETSPACE_API_URL + "/createPrivateView");
					// Add user credential to request header
					postRequest.addHeader("token", SPREADSHEETSPACE_AUTHENTICATION_TOKEN);
					// Initialize new SpreadSheetSpace View required informations structure as a Json string
					String viewData = "{" +
							"\"description\": \"" + viewDescription + "\"," +
							"\"recipients\": " + gson.toJson(recipients) + "," +
							"\"table\": " + gson.toJson(data) + "," +
							"\"isTable\": false," +
							"\"hasHeader\": false," +
							"\"rows\": " + rows + "," +
							"\"cols\": " + cols +
						"}";
					HttpEntity postRequestBody = null;
					if (EXCEL_TEMPLATE_PATH == null) {
						// Create View without Excel template
						// Set request content type to application/json
						postRequest.addHeader(HttpHeaders.CONTENT_TYPE, "application/json");
						// Add View informations Json string to HTTP POST request body
						postRequestBody = new StringEntity(viewData);
					} else {
						// Create View with Excel template
						// Initialize HTTP POST multipart body to include Excel template file along with SpreadSheetSpace View data
						MultipartEntityBuilder builder = MultipartEntityBuilder.create();
						// Add template file to HTTP POST request body
						builder.addBinaryBody("template", new File(EXCEL_TEMPLATE_PATH));
						// Add View informations Json string to HTTP POST request body
						builder.addTextBody("data", viewData, ContentType.APPLICATION_JSON);
						postRequestBody = builder.build();
					}
			        try {
			        	// Set HTTP POST request body
			        	postRequest.setEntity(postRequestBody);
			        	// Execute HTTP POST request to call SpreadSheetSpace REST API
						postResponse = client.execute(postRequest);
						// Check HTTP response status code
						if (postResponse.getStatusLine().getStatusCode() == 200) {
							// Response status OK ==> SpreadSheetSpace View creation completed successfully
							// Parse HTTP response body to retrieve newly created View details
							JsonObject myObject = (new JsonParser()).parse(EntityUtils.toString(postResponse.getEntity())).getAsJsonObject();
							// Store newly created View ID and View Server for future updates
							viewId = myObject.get("viewId").getAsString();
							viewServer = myObject.get("viewServer").getAsString();
							System.out.println("Successfully created SpreadSheetSpace View id: " + viewId + ", server: " + viewServer);
						} else {
							// Response status NOT OK ==> Something went wrong during SpreadSheetSpace View creation process
							System.out.println("Error creating SpreadSheetSpace View");
							ContentType responseContentType = ContentType.get(postResponse.getEntity());
							if (responseContentType != null) {
						        if (responseContentType.getMimeType().equals(ContentType.APPLICATION_JSON.getMimeType())) {
									JsonObject myObject = (new JsonParser()).parse(EntityUtils.toString(postResponse.getEntity())).getAsJsonObject();
									System.out.println(myObject.toString());
						        } else if (responseContentType.getMimeType().equals(ContentType.TEXT_HTML.getMimeType())) {
						        	System.out.println(EntityUtils.toString(postResponse.getEntity()));
						        }
							}
							return;
						}
					} catch (IOException e) {
						e.printStackTrace();
						return;
					}
				} else {
					// A SpreadSheetSpace View has already been created ==> Update existing SpreadSheetSpace View
					System.out.println("Updating SpreadSheetSpace View: " + viewDescription);
					// Initialize HTTP POST request using updateView REST API URL
					HttpPost postRequest = new HttpPost(SPREADSHEETSPACE_API_URL + "/updateView");
					// Add user credential to request header
					postRequest.addHeader("token", SPREADSHEETSPACE_AUTHENTICATION_TOKEN);
					// Set request content type to application/json
					postRequest.addHeader(HttpHeaders.CONTENT_TYPE, "application/json");
					// Initialize SpreadSheetSpace View update required informations structure as a Json string
					String viewData = "{" +
							"\"viewId\": \"" + viewId + "\"," +
							"\"viewServer\": \"" + viewServer + "\"," +
							"\"table\": " + gson.toJson(data) +
						"}";
					// Add View informations Json string to HTTP POST request body
					HttpEntity postRequestBody = new StringEntity(viewData);
					try {
						// Set HTTP POST request body
			        	postRequest.setEntity(postRequestBody);
			        	// Execute HTTP POST request to call SpreadSheetSpace REST API
						postResponse = client.execute(postRequest);
						// Check HTTP response status code
						if (postResponse.getStatusLine().getStatusCode() == 200) {
							// Response status OK ==> SpreadSheetSpace View update completed successfully
							System.out.println("Successfully updated SpreadSheetSpace View id: " + viewId + ", server: " + viewServer);
						} else {
							// Response status NOT OK ==> Something went wrong during SpreadSheetSpace View update process
							System.out.println("Error updating SpreadSheetSpace View: " + viewId);
							ContentType responseContentType = ContentType.get(postResponse.getEntity());
							if (responseContentType != null) {
						        if (responseContentType.getMimeType().equals(ContentType.APPLICATION_JSON.getMimeType())) {
									JsonObject myObject = (new JsonParser()).parse(EntityUtils.toString(postResponse.getEntity())).getAsJsonObject();
									System.out.println(myObject.toString());
						        } else if (responseContentType.getMimeType().equals(ContentType.TEXT_HTML.getMimeType())) {
						        	System.out.println(EntityUtils.toString(postResponse.getEntity()));
						        }
							}
							return;
						}
					} catch (IOException e) {
						e.printStackTrace();
						return;
					}
				}
				// Close any remaining HTTP connection by consuming remaining response content
				if(postResponse != null && postResponse.getEntity() != null ) {
					EntityUtils.consume(postResponse.getEntity());
				}
				// Sleep for UPDATE_INTERVAL milliseconds
				Thread.sleep(UPDATE_INTERVAL);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	/**
	 * A function to generate a bidimensional array of random generated integers
	 * @param rows Bidimensional array rows number
	 * @param cols Bidimensional array columns number
	 * @return A bidimensional array of random generated integers
	 */
	private static String[][] generateRandomData(int rows, int cols) {
		String[][] data = new String[rows][cols];
		for (int i = 0; i < rows; i++) {
			for (int j = 0; j < cols; j++) {
				data[i][j] = String.valueOf(ThreadLocalRandom.current().nextInt(0, 100 + 1));
			}
		}
		return data;
	}
}
  REPORT zspreadsheetspace_APITester.
DATA: spreadsheetspace_api_url     TYPE string VALUE '             TYPE ANY TABLE.
FIELD-SYMBOLS:               TYPE any.
FIELD-SYMBOLS:              TYPE any.
FIELD-SYMBOLS:          TYPE LINE OF ddfields.
PARAMETERS: p_tab TYPE dd02l-tabname. "SAP table name to process
START-OF-SELECTION.
  "Prepare memory area to contain a dynamic table records
  CREATE DATA dyn_tab TYPE TABLE OF (p_tab).
  ASSIGN dyn_tab->* TO .
  "Data estraction
  SELECT * FROM (p_tab) INTO TABLE .
  "View data table header setup (JSON)
  lr_rtti_struc ?= cl_abap_typedescr=>describe_by_name( p_tab ).
  lt_ddic_info = lr_rtti_struc->get_ddic_field_list( ).
  FREE header.
  header = |[ |.
  LOOP AT lt_ddic_info ASSIGNING .
    header = header && -fieldname.
    IF sy-tabix < lines( lt_ddic_info ).
      header = header && |,|.
    ENDIF.
  ENDLOOP.
  header = header && | ]|. 
  "View data table content setup (JSON)
  FREE body.
  LOOP AT  ASSIGNING .
    body = body && |,[ |.
    DO lines( lt_ddic_info ) TIMES.
      ASSIGN COMPONENT sy-index OF STRUCTURE  TO .
      move  to dummy_val.
      condense dummy_val NO-GAPS.
      body = body && .
      IF sy-index < lines( lt_ddic_info ).
        body = body && |,|.
      ENDIF.
    ENDDO.
    body = body && | ]|.
  ENDLOOP.
  "Request body initialization
  FREE: sap_table_json.
  sap_table_json = |[ | && header && body && | ]|.
  request_body = '{ "description":' && view_description && ',"recipients":' && view_recipient && ',"table":' && sap_table_json && ',"isTable":true,"hasHeader":true,"rows":-1,"cols":-1 }'.
  CALL METHOD cl_http_client=>create
    EXPORTING
      host          = spreadsheetspace_api_url
      scheme        = '1'                      "2 for https (You may need to download and setup SSL certificates)
    IMPORTING
      client        = http_client. 
  http_client->propertytype_logon_popup = http_client->co_disabled.
  http_client->request->set_version( if_http_request=>co_protocol_version_1_1 ).
  http_client->request->set_method( if_http_request=>co_request_method_post ).
  http_client->request->set_header_field( name  = '~request_uri' value = '/API/createPrivateView' ).
  http_client->request->set_method( 'POST' ).
  http_client->request->set_header_field( name = 'Host' value = spreadsheetspace_api_url ).
  http_client->request->set_header_field( name = '~server_protocol' value = 'HTTP/1.1' ).
  http_client->request->set_header_field( name  = 'token' value = spreadsheetspace_auth_token ).
  http_client->request->set_content_type( 'application/json' ).
  http_client->request->set_cdata( request_body ).
  "Execute REST API call
  CALL METHOD http_client->send
    EXCEPTIONS
      http_communication_failure = 1
      http_invalid_state         = 2.
  CALL METHOD http_client->receive
    EXCEPTIONS
      http_communication_failure = 1
      http_invalid_state         = 2
      http_processing_failed     = 3.
  IF sy-subrc <> 0. "Something went wrong
    http_client->get_last_error( IMPORTING code = response_code message = response_text ).
    status_code = http_client->response->get_header_field( '~status_code' ).
    status_reason = http_client->response->get_header_field( '~status_reason' ).
    WRITE : / 'Error: ' ,status_code, 'Reason: ', status_reason.
  ELSE.
    MESSAGE i420(fb) WITH 'SpreadSheetSpace View successfully created'.
  ENDIF. 
  result = http_client->response->get_cdata( ).
  "Closing session
  http_client->close( ).
              
						Note: Throughout the documentation, only partial syntax such as: GET /getContacts is used for the sake of brevity. Prefix the path with the correct root URL in order to obtain the full resource path or URL.
					
Retrieve user's contacts list.
GET /getContacts
GET /getContacts?group=groupName| Name | Value | Description | 
|---|---|---|
| token | String | User's authentication token | 
...or alternatively...
| Name | Value | Description | 
|---|---|---|
| username | String | User's SSS username | 
| password | String | User's SSS password | 
import javax.net.ssl.SSLContext;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.MediaType;
import org.glassfish.jersey.SslConfigurator;
[...]
SSLContext ssl = SslConfigurator.newInstance().createSSLContext();
Client client = ClientBuilder.newBuilder().sslContext(ssl).build();
Response response = client.target("[...]
HttpClient client = new HttpClient();
UriBuilder uriBuilder = new UriBuilder();
uribuilder.Scheme = "const request = require("request");
var options = {
    url: "// Using jQuery library
[...]
$.ajax({
	url: "If successful, this method returns a 200 OK response code and the contacts list in the response body as a Json array.
Here is an example of the response.
HTTP/1.1 200 OK Content-type: application/json[ { "firstName": "Alice", "lastName": "Jones", "emailAddress": "alice@spreadsheetspace.net" }, { "firstName": "Bob", "lastName": "Smith", "emailAddress": "bob@spreadsheetspace.net" } ]
Retrieve user's contacts groups.
GET /getGroups| Name | Value | Description | 
|---|---|---|
| token | String | User's authentication token | 
...or alternatively...
| Name | Value | Description | 
|---|---|---|
| username | String | User's SSS username | 
| password | String | User's SSS password | 
import javax.net.ssl.SSLContext;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.MediaType;
import org.glassfish.jersey.SslConfigurator;
[...]
SSLContext ssl = SslConfigurator.newInstance().createSSLContext();
Client client = ClientBuilder.newBuilder().sslContext(ssl).build();
Response response = client.target("[...]
HttpClient client = new HttpClient();
UriBuilder uriBuilder = new UriBuilder();
uribuilder.Scheme = "const request = require("request");
var options = {
    url: "// Using jQuery library
[...]
$.ajax({
	url: "If successful, this method returns a 200 OK response code and the contacts groups list in the response body as a Json array.
Here is an example of the response.
HTTP/1.1 200 OK Content-type: application/json[ { "name": "group1" }, { "name": "group2" } ]
Retrieve user's received Views.
GET /getInboxView| Name | Value | Description | 
|---|---|---|
| token | String | User's authentication token | 
...or alternatively...
| Name | Value | Description | 
|---|---|---|
| username | String | User's SSS username | 
| password | String | User's SSS password | 
import javax.net.ssl.SSLContext;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.MediaType;
import org.glassfish.jersey.SslConfigurator;
[...]
SSLContext ssl = SslConfigurator.newInstance().createSSLContext();
Client client = ClientBuilder.newBuilder().sslContext(ssl).build();
Response response = client.target("[...]
HttpClient client = new HttpClient();
UriBuilder uriBuilder = new UriBuilder();
uribuilder.Scheme = "const request = require("request");
var options = {
    url: "// Using jQuery library
[...]
$.ajax({
	url: "If successful, this method returns a 200 OK response code and the received Views list in the response body as a Json array.
Here is an example of the response.
HTTP/1.1 200 OK Content-type: application/json[ { "view_id": "2f0be38d-d5a5-4e0b-b5fd-9f3c9cff2a13", "view_server": "https://www.spreadsheetspace.net", "owner": "bob@spreadsheetspace.net", "description": "Monthly sales", "listRecipients": [ "john@spreadsheetspace.net", "alice@spreadsheetspace.net" ], "excelType": "VIEW", "is_form": false, "is_table": true, "encrypted": true, "creation": 1509353312137 }, { "view_id": "dbef4732-cc79-4233-ba46-d54249dfc613", "view_server": "https://www.spreadsheetspace.net", "owner": "john@spreadsheetspace.net", "description": "Weekly report", "listRecipients": [ "alice@spreadsheetspace.net" ], "excelType": "VIEW", "is_form": false, "is_table": false, "encrypted": true, "creation": 1508337709116 } ]
Retrieve user's created Views.
GET /getOwnedView| Name | Value | Description | 
|---|---|---|
| token | String | User's authentication token | 
...or alternatively...
| Name | Value | Description | 
|---|---|---|
| username | String | User's SSS username | 
| password | String | User's SSS password | 
import javax.net.ssl.SSLContext;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.MediaType;
import org.glassfish.jersey.SslConfigurator;
[...]
SSLContext ssl = SslConfigurator.newInstance().createSSLContext();
Client client = ClientBuilder.newBuilder().sslContext(ssl).build();
Response response = client.target("[...]
HttpClient client = new HttpClient();
UriBuilder uriBuilder = new UriBuilder();
uribuilder.Scheme = "const request = require("request");
var options = {
    url: "// Using jQuery library
[...]
$.ajax({
	url: "If successful, this method returns a 200 OK response code and the user's created Views list in the response body as a Json array.
Here is an example of the response.
HTTP/1.1 200 OK Content-type: application/json[ { "view_id": "e588c933-6a2e-4d6c-ba24-ecd8bce3f19d", "view_server": "https://www.spreadsheetspace.net", "owner": "alice@spreadsheetspace.net", "description": "Annual review", "listRecipients": [ "bob@spreadsheetspace.net", "john@spreadsheetspace.net" ], "excelType": "VIEW", "is_form": false, "is_table": false, "encrypted": true, "creation": 1525703245399 } ]
Create a SpreadSheetSpace View and send it to a specific set of recipients.
POST /createPrivateView| Name | Value | Description | 
|---|---|---|
| token | String | User's authentication token | 
| content-type | multipart/form-data | Set the request content type to multipart if you want to upload an Excel template file | 
| content-type | application/json | Set the request content type to json if you DO NOT want to upload an Excel template file | 
...or alternatively...
| Name | Value | Description | 
|---|---|---|
| username | String | User's SSS username | 
| password | String | User's SSS password | 
| content-type | multipart/form-data | Set the request content type to multipart if you want to upload an Excel template file | 
| content-type | application/json | Set the request content type to json if you DO NOT want to upload an Excel template file | 
| Name | Value | Description | 
|---|---|---|
| template | File | An Excel .xlsx file containing the Spreadsheet template to apply to the new View | 
| data | application/json | A Json object containing all the required informations to create the new View along with the data table (See code block below) | 
If no Excel template file has to be uploaded, request body must carries a Json object containing all the required informations to create the new View along with the data table (See code block below)
Code block below represent an example of the Json object needed to create the View. This is valid in both cases (with/without template file).
{
	"description": "New view description",
	"recipients": ["recipient@email.com"],
	"table": [["A1", "B1", "C1"],["A2", "B2", "C2"]],
	"isTable": false,
	"hasHeader": false,
	"rows": 10,
	"cols": 7
}Table below specify all the informations that must/might be provided when creating a new View
| Name | Value | Description | 
|---|---|---|
| description | String | The new View description | 
| recipients | application/json | A Json array containing the recipients list | 
| table | application/json | A bidimensional array containing tha actual View data | 
| isTable | Boolean | A boolean to specify if the new View contains an Excel table (Optional, default: false) | 
| hasHeader | Boolean | A boolean to specify if the Excel table has an header (Optional, default: false) | 
| rows | Integer | Number representing the maximum rows of the View. If rows equals "-1" and cols equals "-1" the View is full-sheet. (Optional, default: -1) | 
| cols | Integer | Number representing the maximum cols of the View. If rows equals "-1" and cols equals "-1" the View is full-sheet. (Optional, default: -1) | 
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.HttpClients;
[...]
HttpClient client = HttpClients.createDefault();
HttpPost postRequest = new HttpPost("[...]
HttpClient client = new HttpClient();
UriBuilder uriBuilder = new UriBuilder();
uribuilder.Scheme = "const request = require("request");
var options = {
    url: "// Using jQuery library
[...]					
var viewData = {
	"description": VIEW_DESCRIPTION,
	"recipients": RECIPIENTS_LIST_JSON,
	"table": VIEW_CONTENT_JSON,
	"isTable": IS_TABLE_FLAG,
	"hasHeader": HAS_HEADER_FLAG,
	"rows": VIEW_ROWS_COUNT,
	"cols": VIEW_COLUMNS_COUNT
};
// POST REQUEST WITHOUT EXCEL TEMPLATE FILE
$.ajax({
	url: "If successful, this method returns a 200 OK response code and the newly created View's details in the response body as a Json object.
Here is an example of the response.
HTTP/1.1 200 OK Content-type: application/json{ "viewId": "e588c933-6a2e-4d6c-ba24-ecd8bce3f19d", "viewServer": "https://www.spreadsheetspace.net", "statusCode": "OK", "message": "success", "nextAvailableSequenceNumber": 2 }
Create a SpreadSheetSpace View on the T-Space. This View is hidden, you have to "Publish" it to make it visible. See the documentation of /publishPublicView for more details.
POST /createPublicView| Name | Value | Description | 
|---|---|---|
| token | String | User's authentication token | 
| content-type | multipart/form-data | Set the request content type to multipart if you want to upload an Excel template file | 
| content-type | application/json | Set the request content type to json if you DO NOT want to upload an Excel template file | 
| Name | Value | Description | 
|---|---|---|
| username | String | User's SSS username | 
| password | String | User's SSS password | 
| content-type | multipart/form-data | Set the request content type to multipart if you want to upload an Excel template file | 
| content-type | application/json | Set the request content type to json if you DO NOT want to upload an Excel template file | 
| Name | Value | Description | 
|---|---|---|
| template | File | An Excel .xlsx file containing the Spreadsheet template to apply to the new View | 
| data | application/json | A Json object containing all the required informations to create the new View along with the data table (See code block below) | 
If no Excel template file has to be uploaded, request body must carries a Json object containing all the required informations to create the new View along with the data table (See code block below)
Code block below represent an example of the Json object needed to create the View. This is valid in both cases (with/without template file).
{
	"description": "New view description",
	"table": [["A1", "B1", "C1"],["A2", "B2", "C2"]],
	"isTable": false,
	"hasHeader": false,
	"rows": 10,
	"cols": 7
}Table below specify all the informations that must/might be provided when creating a new View
| Name | Value | Description | 
|---|---|---|
| description | String | The new View description | 
| table | application/json | A bidimensional array containing tha actual View data | 
| isTable | Boolean | A boolean to specify if the new View contains an Excel table (Optional, default: false) | 
| hasHeader | Boolean | A boolean to specify if the Excel table has an header (Optional, default: false) | 
| rows | Integer | Number representing the maximum rows of the View. If rows equals "-1" and cols equals "-1" the View is full-sheet. (Optional, default: -1) | 
| cols | Integer | Number representing the maximum cols of the View. If rows equals "-1" and cols equals "-1" the View is full-sheet. (Optional, default: -1) | 
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.HttpClients;
[...]
HttpClient client = HttpClients.createDefault();
HttpPost postRequest = new HttpPost("[...]
HttpClient client = new HttpClient();
UriBuilder uriBuilder = new UriBuilder();
uribuilder.Scheme = "const request = require("request");
var options = {
    url: "// Using jQuery library
[...]					
var viewData = {
	"description": VIEW_DESCRIPTION,
	"table": VIEW_CONTENT_JSON,
	"isTable": IS_TABLE_FLAG,
	"hasHeader": HAS_HEADER_FLAG,
	"rows": VIEW_ROWS_COUNT,
	"cols": VIEW_COLUMNS_COUNT
};
// POST REQUEST WITHOUT EXCEL TEMPLATE FILE
$.ajax({
	url: "If successful, this method returns a 200 OK response code and the newly created View's details in the response body as a Json object.
Here is an example of the response.
HTTP/1.1 200 OK Content-type: application/json{ "viewId": "2f426665-76d5-4650-97a4-da9dcde260f9", "viewServer": "https://www.spreadsheetspace.net", "statusCode": "OK", "message": "success", "nextAvailableSequenceNumber": 2 }
Update the data and the template of an existing SpreadSheetSpace View. See the documentation of /createPrivateView to learn how to create a View.
POST /updateView| Name | Value | Description | 
|---|---|---|
| token | String | User's authentication token | 
| content-type | multipart/form-data | Set the request content type to multipart if you want to update the Excel template file | 
| content-type | application/json | Set the request content type to json if you DO NOT want to update the Excel template file | 
| Name | Value | Description | 
|---|---|---|
| username | String | User's SSS username | 
| password | String | User's SSS password | 
| content-type | multipart/form-data | Set the request content type to multipart if you want to update the Excel template file | 
| content-type | application/json | Set the request content type to json if you DO NOT want to update the Excel template file | 
| Name | Value | Description | 
|---|---|---|
| template | File | An Excel .xlsx file containing the new Spreadsheet template to apply to the View | 
| data | application/json | A Json object containing all the required informations to identify the View to update along with the data table (See code block below) | 
If no Excel template file has to be uploaded, request body must carries a Json object containing all the required informations to identify the View to update along with the data table (See code block below)
Code block below represent an example of the Json object needed to update a specific View. This is valid in both cases (with/without template file).
{
	"viewId": "13abc7a1-716c-4ed7-acac-9a628386f0ab",
	"viewServer": "https://www.spreadsheetspace.net",
	"table": [["A1", "B1", "C1"],["A2", "B2", "C2"]]
}Table below specify all the informations that must/might be provided when updating a View
| Name | Value | Description | 
|---|---|---|
| viewId | String | The identifier of the View that you want to update | 
| viewServer | String | The server address where is stored the View you want to update | 
| table | application/json | A bidimensional array containing tha actual View data | 
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.HttpClients;
[...]
HttpClient client = HttpClients.createDefault();
HttpPost postRequest = new HttpPost("[...]
HttpClient client = new HttpClient();
UriBuilder uriBuilder = new UriBuilder();
uribuilder.Scheme = "const request = require("request");
var options = {
    url: "// Using jQuery library
[...]					
var viewData = {
	"viewId": VIEW_ID,
	"viewServer": VIEW_SERVER,
	"table": VIEW_CONTENT_JSON
};
// POST REQUEST WITHOUT EXCEL TEMPLATE FILE
$.ajax({
	url: "If successful, this method returns a 200 OK response code and the updated View's details in the response body as a Json object.
Here is an example of the response.
HTTP/1.1 200 OK Content-type: application/json{ "viewId": "13abc7a1-716c-4ed7-acac-9a628386f0ab", "viewServer": "https://jarvis.spreadsheetspace.net", "statusCode": "OK", "message": "success", "nextAvailableSequenceNumber": 4 }
Publish on T-Space of an existing Public View. See the documentation of /createPublicView to learn how to create a public View.
POST /publishPublicView| Name | Value | Description | 
|---|---|---|
| token | String | User's authentication token | 
| content-type | application/json | Specifies request's body content type | 
| Name | Value | Description | 
|---|---|---|
| username | String | User's SSS username | 
| password | String | User's SSS password | 
| content-type | application/json | Specifies request's body content type | 
Request body must carries a Json object containing all the required informations to identify the View to be published into the T-Space (See code block below)
Code block below represent an example of the Json object needed to publish a specific View.
{
	"viewId": "2f426665-76d5-4650-97a4-da9dcde260f9",
	"viewServer": "https://www.spreadsheetspace.net",
	"comment": "Detailed description of View's content"
}Table below specify all the informations that must/might be provided when publishing a View
| Name | Value | Description | 
|---|---|---|
| viewId | String | The identifier of the View that you want to update | 
| viewServer | String | The server address where is stored the View you want to update | 
| comment | String | This string represents a detailed description of the View. This description is shows as a comment on T-Space. | 
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.HttpClients;
[...]
HttpClient client = HttpClients.createDefault();
HttpPost postRequest = new HttpPost("[...]
HttpClient client = new HttpClient();
UriBuilder uriBuilder = new UriBuilder();
uribuilder.Scheme = "const request = require("request");
var options = {
    url: "// Using jQuery library
[...]					
var viewData = {
	"viewId": VIEW_ID,
	"viewServer": VIEW_SERVER,
	"comment": VIEW_COMMENT
};
$.ajax({
	url: "If successful, this method returns a 200 OK response code and the publication process result in the response body as a Json object.
Here is an example of the response.
HTTP/1.1 200 OK Content-type: application/json{ "statusCode": "OK", "messages": [ "publishPublicView: Success" ], }
Delete an owned View on SpreadSheetSpace.
POST /deleteView| Name | Value | Description | 
|---|---|---|
| token | String | User's authentication token | 
| content-type | application/json | Specifies request's body content type | 
| Name | Value | Description | 
|---|---|---|
| username | String | User's SSS username | 
| password | String | User's SSS password | 
| content-type | application/json | Specifies request's body content type | 
Request body must carries a Json object containing all the required informations to identify the View to be deleted (See code block below)
Code block below represent an example of the Json object needed to delete a specific View.
{
	"viewId": "e588c933-6a2e-4d6c-ba24-ecd8bce3f19d",
	"viewServer": "https://www.spreadsheetspace.net"
}Table below specify all the informations that must/might be provided when deleting a View
| Name | Value | Description | 
|---|---|---|
| viewId | String | The identifier of the View that you want to delete | 
| viewServer | String | The server address where is stored the View you want to delete | 
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.HttpClients;
[...]
HttpClient client = HttpClients.createDefault();
HttpPost postRequest = new HttpPost("[...]
HttpClient client = new HttpClient();
UriBuilder uriBuilder = new UriBuilder();
uribuilder.Scheme = "const request = require("request");
var options = {
    url: "// Using jQuery library
[...]					
var viewData = {
	"viewId": VIEW_ID,
	"viewServer": VIEW_SERVER
};
$.ajax({
	url: "If successful, this method returns a 200 OK response code and the delete process result in the response body as a Json object.
Here is an example of the response.
HTTP/1.1 200 OK Content-type: application/json{ "statusCode": "OK", "messages": [ "deleteViews: Success" ], }
Delete owned views on SpreadSheetSpace.
POST /deleteViews| Name | Value | Description | 
|---|---|---|
| token | String | User's authentication token | 
| content-type | application/json | Specifies request's body content type | 
| Name | Value | Description | 
|---|---|---|
| username | String | User's SSS username | 
| password | String | User's SSS password | 
| content-type | application/json | Specifies request's body content type | 
Request body must carries a Json array containing a list of the required informations to identify all the Views to be deleted (See code block below)
Code block below represent an example of the Json array needed to delete some Views.
[
	{
		"viewId": "e588c933-6a2e-4d6c-ba24-ecd8bce3f19d",
		"viewServer": "https://www.spreadsheetspace.net"
	},
	{
		"viewId": "8a6e8e66-2c27-48c4-afda-c0879644c48c",
		"viewServer": "https://www.spreadsheetspace.net"
	}
]Table below specify all the informations that must/might be provided when deleting a View
| Name | Value | Description | 
|---|---|---|
| viewId | String | The identifier of the View that you want to update | 
| viewServer | String | The server address where is stored the View you want to update | 
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.HttpClients;
[...]
HttpClient client = HttpClients.createDefault();
HttpPost postRequest = new HttpPost("[...]
HttpClient client = new HttpClient();
UriBuilder uriBuilder = new UriBuilder();
uribuilder.Scheme = "const request = require("request");
var options = {
    url: "// Using jQuery library
[...]					
var viewData = [{
		"viewId": VIEW_ID_1,
		"viewServer": VIEW_SERVER_1
	}, {
		"viewId": VIEW_ID_2,
		"viewServer": VIEW_SERVER_2
}];
$.ajax({
	url: "If successful, this method returns a 200 OK response code and the delete process result in the response body as a Json object.
Here is an example of the response.
HTTP/1.1 200 OK Content-type: application/json{ "statusCode": "OK", "messages": [ "deleteViews: Success" ], }
Add recipient(s) to an existing View.
POST /addRecipients| Name | Value | Description | 
|---|---|---|
| token | String | User's authentication token | 
| content-type | application/json | Specifies request's body content type | 
| Name | Value | Description | 
|---|---|---|
| username | String | User's SSS username | 
| password | String | User's SSS password | 
| content-type | application/json | Specifies request's body content type | 
Request body must carries a Json array containing a list of the required informations to identify the desired View and the recipients list to be added (See code block below)
Code block below represent an example of the Json array needed to add recipients to a specific View.
{
	"viewId": "e588c933-6a2e-4d6c-ba24-ecd8bce3f19d",
	"viewServer": "https://www.spreadsheetspace.net",
	"recipients": [
		"newRecipient@email.com",
		"newRecipient2@email.com"
	]
}Table below specify all the informations that must/might be provided when adding recipients to a specific View
| Name | Value | Description | 
|---|---|---|
| viewId | String | The identifier of the View that you want to update | 
| viewServer | String | The server address where is stored the View you want to update | 
| recipients | application/json | A Json array containing the recipients list to add | 
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.HttpClients;
[...]
HttpClient client = HttpClients.createDefault();
HttpPost postRequest = new HttpPost("[...]
HttpClient client = new HttpClient();
UriBuilder uriBuilder = new UriBuilder();
uribuilder.Scheme = "const request = require("request");
var options = {
    url: "// Using jQuery library
[...]					
var viewData = {
	"viewId": VIEW_ID,
	"viewServer": VIEW_SERVER,
	"recipients": RECIPIENTS_LIST_JSON
};
$.ajax({
	url: "If successful, this method returns a 200 OK response code and the operation result in the response body as a Json object.
Here is an example of the response.
HTTP/1.1 200 OK Content-type: application/json{ "viewId": "2bd25324-fcb3-49f4-aa52-41859d6fd71a", "viewServer": "http://172.25.1.140:8080", "statusCode": "OK", "message": [ "addRecipients: Success" ] }
Remove recipient(s) from an existing View.
POST /removeRecipients| Name | Value | Description | 
|---|---|---|
| token | String | User's authentication token | 
| content-type | application/json | Specifies request's body content type | 
| Name | Value | Description | 
|---|---|---|
| username | String | User's SSS username | 
| password | String | User's SSS password | 
| content-type | application/json | Specifies request's body content type | 
Request body must carries a Json array containing a list of the required informations to identify the desired View and the recipients list to be removed (See code block below)
Code block below represent an example of the Json array needed to remove recipients from a specific View.
{
	"viewId": "e588c933-6a2e-4d6c-ba24-ecd8bce3f19d",
	"viewServer": "https://www.spreadsheetspace.net",
	"recipients": [
		"recipient@email.com",
		"recipient2@email.com"
	]
}Table below specify all the informations that must/might be provided when removing recipients from a specific View
| Name | Value | Description | 
|---|---|---|
| viewId | String | The identifier of the View that you want to update | 
| viewServer | String | The server address where is stored the View you want to update | 
| recipients | application/json | A Json array containing the recipients list to remove | 
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.HttpClients;
[...]
HttpClient client = HttpClients.createDefault();
HttpPost postRequest = new HttpPost("[...]
HttpClient client = new HttpClient();
UriBuilder uriBuilder = new UriBuilder();
uribuilder.Scheme = "const request = require("request");
var options = {
    url: "// Using jQuery library
[...]					
var viewData = {
	"viewId": VIEW_ID,
	"viewServer": VIEW_SERVER,
	"recipients": RECIPIENTS_LIST_JSON
};
$.ajax({
	url: "If successful, this method returns a 200 OK response code and the operation result in the response body as a Json object.
Here is an example of the response.
HTTP/1.1 200 OK Content-type: application/json{ "viewId": "2bd25324-fcb3-49f4-aa52-41859d6fd71a", "viewServer": "http://172.25.1.140:8080", "statusCode": "OK", "message": [ "removeRecipients: Success" ] }
Generate a new key pair.
GET /generateKeys| Name | Value | Description | 
|---|---|---|
| token | String | User's authentication token | 
...or alternatively...
| Name | Value | Description | 
|---|---|---|
| username | String | User's SSS username | 
| password | String | User's SSS password | 
import javax.net.ssl.SSLContext;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.MediaType;
import org.glassfish.jersey.SslConfigurator;
[...]
SSLContext ssl = SslConfigurator.newInstance().createSSLContext();
Client client = ClientBuilder.newBuilder().sslContext(ssl).build();
Response response = client.target("[...]
HttpClient client = new HttpClient();
UriBuilder uriBuilder = new UriBuilder();
uribuilder.Scheme = "const request = require("request");
var options = {
    url: "// Using jQuery library
[...]
$.ajax({
	url: "If successful, this method returns a 200 OK response code and the newly generated key pair in the response body as a Json object.
Here is an example of the response.
HTTP/1.1 200 OK Content-type: application/json{ "publicKey": "<RSAKeyValue>\n\t<Modulus>pdmvRyInEkm1hwzcrgy1e45vp7wyJ0Q...</Modulus>\n\t<Exponent>AQAB</Exponent>\n</RSAKeyValue>", "privateKey": "<RSAKeyValue>\n\t<Modulus>pdmvRyInEkm1hwzcrgy1e45vp7wyJ0Q...</Modulus>\n\t<Exponent>AQAB</Exponent>\n\t<P>/mVPXEdOotAM0mkcl...</P>\n\t<Q>puVt4ZV5C+...</Q>\n\t<DP>GvJkS6QKAl...</DP>\n\t<DQ>hAVFMIdO444h...</DQ>\n\t<InverseQ>SDJIQtQdzIj...</InverseQ>\n\t<D>amNRhJfr6FdQ...</D>\n</RSAKeyValue>", "statusCode": "OK" }
Retrieve data of a SpreadSheetSpace View.
POST /getData| Name | Value | Description | 
|---|---|---|
| token | String | User's authentication token | 
| content-type | application/json | Specifies request's body content type | 
| Name | Value | Description | 
|---|---|---|
| username | String | User's SSS username | 
| password | String | User's SSS password | 
| content-type | application/json | Specifies request's body content type | 
Request body must carries a Json object containing all the required informations to identify the View to be retrieved and the user's private key to decrypt the data (See code block below)
Code block below represent an example of the Json object needed to retrieve data of a specific View.
{
	"viewId": "e588c933-6a2e-4d6c-ba24-ecd8bce3f19d",
	"viewServer": "https://www.spreadsheetspace.net",
	"privateKey": "<RSAKeyValue>\n\t<Modulus>pdmvRyInEkm1hwzcrgy1e45vp7wyJ0Q...</Modulus>\n\t<Exponent>AQAB</Exponent>\n\t<P>/mVPXEdOotAM0mkcl...</P>\n\t<Q>puVt4ZV5C+...</Q>\n\t<DP>GvJkS6QKAl...</DP>\n\t<DQ>hAVFMIdO444h...</DQ>\n\t<InverseQ>SDJIQtQdzIj...</InverseQ>\n\t<D>amNRhJfr6FdQ...</D>\n</RSAKeyValue>"
}Table below specify all the informations that must/might be provided when retrieving data of a View
| Name | Value | Description | 
|---|---|---|
| viewId | String | The identifier of the View that you want to retrieve | 
| viewServer | String | The server address where is stored the View you want to retrieve | 
| privateKey | String | The user's private key to decrypt View data | 
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.HttpClients;
[...]
HttpClient client = HttpClients.createDefault();
HttpPost postRequest = new HttpPost("[...]
HttpClient client = new HttpClient();
UriBuilder uriBuilder = new UriBuilder();
uribuilder.Scheme = "const request = require("request");
var options = {
    url: "// Using jQuery library
[...]					
var viewData = {
	"viewId": VIEW_ID,
	"viewServer": VIEW_SERVER,
	"privateKey": PRIVATE_KEY
};
$.ajax({
	url: "If successful, this method returns a 200 OK response code and the desired View data in the response body as a Json object.
Here is an example of the response.
HTTP/1.1 200 OK Content-type: application/json{ "values": [ [ "A", "B", "C" ], [ "1", "2", "3" ] ], "statusCode": "OK", "seqNum": 1, }