GetPackage() Method

You use the GetPackage() method to get the content of a customization project from the database of an MYOB Acumatica instance.

Syntax

public byte[] GetPackage(string packageName)

Parameters

  • packageName: The name of the customization project to be loaded from the database.

Return Value

The method returns an array of bytes that corresponds to the content of the deployment package .zip file.

Example

The following code logs in to an MYOB Acumatica instance, gets the content of the package1 customization project from the database, and returns the content as a byte array. You can then, for example, save the array to a .zip file to download the deployment package in the file system.

var webserviceurl = "http://localhost/AcumaticaInstance/api/ServiceGate.asmx";
var username = "admin";
var password = "123";
var packageName = "package1";

var client = new ServiceGate.ServiceGate
{
  Url = webserviceurl,
  CookieContainer = new CookieContainer(),
  Timeout = (int) TimeSpan.FromMinutes(5).TotalMilliseconds
};

var loginResult = client.Login(username, password);

if (loginResult.Code == ErrorCode.OK)
{
  var packageContents = client.GetPackage(packageName);
  //do something with the packageContents package content
}

Usage Notes

If there are multiple tenants in an instance of MYOB Acumatica, this method affects the tenant to which the service is logged in. To log in to a specific tenant, add the tenant name to the user name using the following format: user@MyTenant.