This API call is used to create a account. The new account inherits the properties of the account used to create it (the one making the API call).
Deprecated Versions
(none)
Required Parameters
Parameter | Description |
Action | CreateAccount |
AccountId | The MessageGears account id to which this item belongs. |
ApiKey | A secret key only known by you. Keep this key confidential. |
Name | The name of the account to be created. |
Optional Parameters
Parameter | Description |
AutoTrack | Change the default value for all jobs sent through this account to “true” or “false” |
UrlAppend | Change the default string to be appended to all tracking links for this account |
CustomTrackingDomain | Change the default domain to be used for all tracking URLs (click, open, unsubscribe) |
Programming Examples
REST
Request
https://api.messagegears.net/3.1/WebService
?Action=CreateAccount
&AccountId=123456789
&ApiKey=8bb6118f8fd6935ad0876a3be34a717d32708ffd
&Name=Quality Assurance Account
Response
<CreateAccountResponse>
<RequestId>e311-89fff13f-9866-4e5d-856f-7bd01cb612d3</RequestId>
<Result>REQUEST_SUCCESSFUL</Result>
<Account>
<Id>70916599</Id>
<ApiKey>4a3140d4ae7449b3832aae7449b383</ApiKey>
</Account>
</CreateAccountResponse>
Java SDK
package com.messagegears.examples;
import com.messagegears.sdk.MessageGearsClient;
import com.messagegears.sdk.MessageGearsProperties;
import com.messagegears.sdk.model.request.CreateAccountRequest;
import com.messagegears.sdk.output.ScreenWriter;
import com.messagegears.sdk.v3_1.CreateAccountResponse;
public class CreateAccount {
public static final String MY_EMAIL_ADDRESS = "place your email address here";
public static final String MY_MESSAGEGEARS_ACCOUNT_ID = "place your MessageGears account id here";
public static final String MY_MESSAGEGEARS_API_KEY = "place your MessageGears api key here";
public static void main(String[] args) {
// Create the properties object containing the necessary properties
MessageGearsProperties properties = new MessageGearsProperties();
properties.setMyMessageGearsAccountId(MY_MESSAGEGEARS_ACCOUNT_ID);
properties.setMyMessageGearsApiKey(MY_MESSAGEGEARS_API_KEY);
// Create the main client object
MessageGearsClient client = new MessageGearsClient(properties);
// Create a bulk campaign request
CreateAccountRequest request = new CreateAccountRequest();
// Set the URL where the recipient XML file can be retrieved
request.setName("QA Account");
// Set auto link tracking to true
request.setAutoTrack(true);
// Execute the request
CreateAccountResponse response = client.createAccount(request);
// Print the result (success or failure)
ScreenWriter.printResponse(response);
}
}
C# SDK
using System;
using MessageGears;
using MessageGears.Model;
using MessageGears.Model.Generated;
namespace MessageGears.Sample
{
public class CreateAccountSample
{
// Replace this value with your email address
public const String MY_EMAIL_ADDRESS = "place your email address here";
public const String MY_MESSAGEGEARS_ACCOUNT_ID = "place your MessageGears account id here";
public const String MY_MESSAGEGEARS_API_KEY = "place your MessageGears api key here";
public static void Main ()
{
// Create the properties object containing the necessary properties
MessageGearsProperties props = new MessageGearsProperties();
props.MyMessageGearsAccountId = MY_MESSAGEGEARS_ACCOUNT_ID;
props.MyMessageGearsApiKey = MY_MESSAGEGEARS_API_KEY;
// Create the main client object
MessageGearsClient client = new MessageGearsClient(props);
// Create a bulk campaign request
CreateAccountRequest request = new CreateAccountRequest();
// Set the Account Name
request.Name = "QA Account";
// Set the default for Auto Tracking of links
request.AutoTrack = false;
// Execute the request
CreateAccountResponse response = client.CreateAccount(request);
// Print the result (success or failure)
Console.WriteLine("New Account ID: " + response.Account.Id);
client.PrintResponse(response);
}
}
}
Comments
Article is closed for comments.