You can download one of the following demonstration projects to access the SDK files. All projects include a service directory which will contain the code necessary to consume this service.
Use these examples to learn how to interact with the service, or simply copy the service directory into your project to begin working right away.
The download provided above is an archive containing several Postman collections. Each collection has many pre-populated requests that interact with the Tessitura API. Postman is a complete API development environment and is available as an app for Windows, MacOS, and Linux operating systems. To learn more and download Postman, go to getpostman.com.
Once you are set up, you can begin sending the requests provided in the sample collections. In many of the requests like those found in the Cart and Checkout collection, some parameters rely on data from previous requests. You will need to copy the necessary data from the previous request into the current one. However, when creating a session key, it will be automatically be stored into the environment and used for subsequent requests that require a session key.
Download C# SDK (.NET Standard, compiled)
Download C# SDK (.NET Framework, source only)
The .NET Standard SDK offered as a compiled package will be the only C# SDK supported starting with 16.0. The legacy SDK built in .NET Framework and offered as source will be retired in 16.0.
// Create an instance of the service
var baseUri = "[YourApiBaseUri]";
var timeout = 5000;
tessituraService = new TessituraServiceFacade(baseUri, timeout);
// Add our auth header (This is obviously not how you would manage credentials,
// but for clarity we will just hardcode values here.)
var userCredentials = new UserCredentials("admin", "allright", "machine", "password");
tessituraService.SetCredentials(userCredentials);
// That's it. Let's make a call
var priceTypesResponse = await tessituraService.Txn.PriceTypes.GetAll();
if (priceTypesResponse.ErrorMessages != null)
{
ShowErrorsAndExit(priceTypesResponse.ErrorMessages);
return;
}
Console.WriteLine("Pricetypes:");
Console.WriteLine("----------------------------------------------");
foreach (var priceType in priceTypesResponse.ResponseObject)
{
Console.WriteLine(priceType.Description);
}
Console.WriteLine();
// Create an instance of the service
String baseUri = "[YourApiBaseUri]";
Integer timeout = 5000;
tessituraServiceFacade = new TessituraServiceFacade(baseUri, timeout);
// Add our auth header (This is obviously not how you would manage credentials,
// but for clarity we will just hardcode values here.)
tessituraServiceFacade.setAuthentication("admin:admin:machine:password");
// That's it. Let's make a call
RestResponse<pricetypesummaries> response = tessituraServiceFacade.Txn.PriceTypes.GetSummaries(false);
if(response.hasErrors()){
for (ErrorMessage error : response.getErrorMessages() ){
System.out.println(error.toString());
}
return;
}
System.out.println("Pricetypes:");
System.out.println("----------------------------------------------");
for (PriceTypeSummary pt : response.getResponseObject()){
System.out.println(pt.Description);
}
//Create an instance of the service and add the auth header information (This is obviously not how you would manage credentials, but for clarity we will just hardcode values here.)
String baseUri = "[YourApiBaseUri]";
tessituraServiceFacade = new TessituraServiceFacade(this, baseUri, "admin:admin:machine:password");
//Setup a service listener
Response.Listener<RestResponse<PriceTypeSummaries>> priceTypeSummariesListener = new Response.Listener<RestResponse<PriceTypeSummaries>>() {
@Override
public void onResponse(RestResponse<PriceTypeSummaries> response) {
StringBuilder sb = new StringBuilder();
if(response.hasErrors()){
for(ErrorMessage e : response.getErrorMessages()){
sb.append(e.Description + "\n");
}
}else {
for (PriceTypeSummary p : response.getResponseObject()) {
sb.append(p.Description + "\n");
}
}
resultTxt.setText(sb.toString());
}
};
// That's it. Let's make a call
tessituraServiceFacade.Txn.PriceTypes.GetSummaries(priceTypeSummariesListener);
package main
import (
"fmt"
"gotess"
)
func main() {
client := gotess.NewClient(nil)
client.SetBaseURL("[YourApiBaseUri]")
client.SetCredentials("username", "usergroup", "machine", "password")
response, err := client.TXN.PriceTypes.GetSummaries(nil)
if err != nil {
if terr, ok := err.(*gotess.ErrorResponse); ok {
// this is an error from the Tessitura API
// use terr to access the list of ErrorMessages or the raw http response
fmt.Printf("Error: HTTP Status Code: %d\n", terr.Response.StatusCode)
fmt.Printf("Tessitura returned %d errors\n", len(*terr.ErrorMessages))
fmt.Printf("Tessitura responded: %s\n", terr.Error())
} else {
// this is a different error. maybe an http or deserialization error
panic(err)
}
return
}
fmt.Println("Pricetypes:")
fmt.Println("----------------------------------------------")
for _, v := range *response {
fmt.Println(*v.Description)
}
}