Send Message


Developers may want to dynamically update the content of their taggs. In the case of newsletter taggs, successful updates will result in newsletter subscribers receiving the updated tagg content.

POST URL:
http://tagga.com/api/update/

POST Parameters:

  1. apikey - Developer API key, retrieve from API account at tagga.com
  2. passkey - Developer Password key, emailed to developer when API account approved
  3. tagg - Keyword of tagg to be updated.
  4. title - Title of tagg visible online at tagga.com, must be between 0 and 100 characters (Optional)
  5. message - New message content of updated tagg, must be between 0 and 80 characters for non paid taggs and between 0 and 120 for paid taggs

Restrictions:

  1. Developer can only update a tagg once per hour
  2. Developer must own a tagg in order to update it

Response:
An XML response is returned and details a unique transaction ID, response code, and response message. You are responsible for checking the response message and acting appropriately.

Back to top

PHP


$postdata = http_build_query(
  array(
    'apikey' => 'abc123', // put your API key here
    'passkey' => '321cba', // put your API password key here
    'tagg' => 'sometagg', // the tagg you want to update
    'title' => 'Sample Tagg Title', // New tagg title
    'message' => 'This is the new message of my updated tagg.'
  )
);

$opts = array(
  'http' => array(
    'method' => 'POST',
    'header' => 'Content-type: application/x-www-form-urlencoded',
    'content' => $postdata
  )
);

$context = stream_context_create($opts);
$response = file_get_contents(
  'http://tagga.com/api/update/',
  false,
  $context
);

// handle the response message


Python


import urllib

apikey = u'abc123' # put your API key here
passkey = u'321cba' # put your API password key here
tagg = u'sometagg' # the tagg you want to update
title = u'Sample Tagg Title' # New tagg title
message = u'This is the new message of my updated tagg.'

postdata = urllib.urlencode({'apikey': apikey, 'passkey': passkey, 'tagg': tagg, 'title': title, 'message': message})

response = urllib.urlopen('http://tagga.com/api/update/', postdata)

# handle the response message


Java


try {

  String postdata = URLEncoder.encode("apikey", "UTF-8") + "=" + URLEncoder.encode("abc123", "UTF-8");
  postdata += "&" + URLEncoder.encode("passkey", "UTF-8") + "=" + URLEncoder.encode("321cba", "UTF-8");
  postdata += "&" + URLEncoder.encode("tagg", "UTF-8") + "=" + URLEncoder.encode("sometagg", "UTF-8");
  postdata += "&" + URLEncoder.encode("title", "UTF-8") + "=" + URLEncoder.encode("Sample Tagg Title", "UTF-8");
  postdata += "&" + URLEncoder.encode("message", "UTF-8") + "=" + URLEncoder.encode("This is the new message of my updated tagg.", "UTF-8");

  // Send data
  URL url = new URL("http://tagga.com/api/update/");
  URLConnection conn = url.openConnection();
  conn.setDoOutput(true);
  OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
  wr.write(postdata);
  wr.flush();

  // Get the response
  BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));

  // handle the response here
  wr.close();
  rd.close();
} catch(Exception exc) {

  // handle any exceptions
}


Back to top

Sample Success Response


<?xml version="1.0" encoding="UTF-8"?>
<TaggaResponse version="1.0">
  <TransactionID>100</TransactionID>
  <ReturnCode>0</ReturnCode>
  <Message>Success - API function call successful</Message>
</TaggaResponse>

Sample Error Response


<?xml version="1.0" encoding="UTF-8"?>
<TaggaResponse version="1.0">
  <TransactionID>101</TransactionID>
  <ReturnCode>14</ReturnCode>
  <Message>Free Message Length Invalid - Message text must be between 0 and 80 characters for the latin character set, and 0 and 40 for all others</Message>
</TaggaResponse>

Back to top
0: Success - API function call successful
2: Authentication Failed - apikey and passkey not valid
3: Incomplete API Call - Not all required parameters passed in
6: Invalid Input - Some or all of the required parameters are invalid
7: Unknown Remote Address - This IP address is not allowed
8: Unknown tagg - Input tagg cannot be found
11: Title too long - Title text must be between 0 and 100 characters
12: Update Frequency Exceeded - You have exceeded the update frequency for this tagg
13: Not tagg owner - tagg does not belong to developer trying to update it
14: Free Message Length Invalid - Message text must be between 0 and 80 characters for the latin character set, and 0 and 40 for all others
15: Paid Message Length Invalid - Message text must be between 0 and 120 characters for the latin character set, and 0 and 60 for all others

Back to top