Event Attachment OpCode EAI: Add an Attachments to an Event
Event Attachment OpCode EAI: Add an Attachments to an Event
This opcode is used to add a new attachment to the list of attachments (documents/links) for the specified event. The event to add the attachment to may be identified by specifying the EventKey, EventDescription, or EventCode.
Attachments can be links (URLs) or actual files uploaded to the system. When adding URL links, no special treatment is necessary. However, when uploading files, certain steps must be taken. File uploads must be the only opcode specified in the OpCodeList. This means that uploading files must be done as separate calls to the API. Additionally, uploading of files must be done using https multi-part form posts. An example html form below illustrates this:
<html>
<body>
<form method="post" action="https://api.onlinexperiences.com/scripts/Server.nxp" ENCTYPE="multipart/form-data">
<input type="hidden" name="LASCmd" value="AI:4;F:APIUTILS!50540" />
<input type="hidden" name="OpCodeList" value="EAI" />
<input type="hidden" name="APIUserCredentials" value="YourCredentialsHere" />
<input type="hidden" name="APIUserAuthCode" value="YourAuthCodeHere" />
<input type="hidden" name="ShowKey" value="98765" />
<input type="hidden" name="EventKey" value="123456" />
<h2>Add Uploaded Document Attachment</h2>
<table width="100%">
<tr>
<td width="25%" nowrap>Description</td>
<td ><input name="AttachmentDescription" maxlength="800" size="40" /></td>
</tr>
<tr>
<td width="25%" nowrap>Subject Category</td>
<td>
<select name="AttachmentSubjectCategoryKey">
<option value="0" selected>(default)</option>
</select>
</td>
</tr>
<tr>
<td width="25%" nowrap>Category</td>
<td>
<select name="AttachmentCategory">
<option value="0">General</option>
<option value="1">Brochures</option>
<option value="2">Fact Sheets</option>
<option value="3">Literature</option>
<option value="4">Podcasts</option>
<option value="5">Product Info</option>
<option value="6">Presentations</option>
<option value="7">Whitepapers</option>
</select>
</td>
</tr>
<tr>
<td width="25%" nowrap>Display Order</td>
<td><input name="AttachmentDisplayOrder" maxlength="9" size="9" /> (numeric only)</td>
</tr>
<tr>
<td width="25%" nowrap>Select File To Upload</td>
<td nowrap>
<input type="file" name="AttachmentData" size="50" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Upload Attachment" />
</td>
</tr>
</table>
</form>
</html>
Calling the API
The API is called via a secure HTTPS request. This HTTPS request may be a GET or POST operation (except for file uploading which requires a multi-part form post). Each request must supply the authentication credentials assigned to the caller by Notified. Only requests with valid credentials will be processed. These credentials identify the caller and provide access only to a specific customer area.
The format of the API call is: https://api.onlinexperiences.com/scripts/Server.nxp?LASCmd=AI:4;F:APIUTILS!50540&APIUserAuthCode={YourAuthCode}&APIUserCredentials={YourCredentials}&OpCodeList={Opcode[OpCode[…]]}&OutputFormat={X|H|T(default)}&ShowKey={ShowKey}&{Additional, opcode-specific parameters in name=value format…}
Specific parameter ordering is unimportant, with the only restriction being that the first parameter MUST BE LASCmd=AI:4;F:APIUTILS!50540. All other parameters may appear in any sequence order.
API Parameter |
Type/Size |
Req. |
Comment |
---|---|---|---|
APIUserAuthCode |
Varchar 80 |
Y |
Your API authorization code as supplied by Notified. |
APIUserCredentials |
Varchar 80 |
Y |
Your API user credentials as supplied by Notified. |
OpCodeList |
Varchar 2000 |
Y |
Should include EAI to invoke this function. |
OutputFormat |
Char 1 |
N |
T for text, H for HTTP URL-encoded, or X for XML. Defaults to T. |
ShowKey |
Integer |
Y |
The ShowKey that the event belongs to. |
EventKey |
Integer |
N |
The event key to add the attachment to. |
EventCode |
Varchar 255 |
N |
The event code to add the attachment to. |
EventDescription |
Varchar 355 |
N |
The description of the event to add the attachment to. |
AttachmentDescription |
Varchar 800 |
Y |
The description of this attachment. |
Attachment |
Varchar 2000 |
N |
If the attachment is a link, rather than a file upload, then this contains the URL. Otherwise, this parameter should be omitted. |
AttachmentData |
Binary blob |
N |
If the attachment is a file upload, then this parameter contains the actual document contents. Otherwise, this parameter can be omitted. |
AttachmentCategory |
Integer |
N |
Category for this attachment. (See OpCode CTL) |
AttachmentSubjectCategoryKey |
Integer |
N |
Subject Category of this attachment. (See OpCode SCL) |
AttachmentDisplayOrder |
Integer |
N |
Display order index to be used when listing attachments. |
Return Outputs
This API returns the status message OK and the new AttachmentKey upon successful completion.
Text
### APICallResult=0 APICallDiagnostic=OK OpCodesProcessed=1 OpCodesInError=0
## OpCode=EAI Status=0 Message=OK
AttachmentKey
123456
HTTP URL-encoded
APICallResult=0&APICallDiagnostic=OK&OpCodesProcessed=1& OpCodesInError=0&OpCode=EAI&Status=0&Message=OK&AttachmentKey=123456
XML
<?xml version="1.0" encoding="utf-8" ?>
<APIResults APICallResult="0" APICallDiagnostic="OK" OpCodesProcessed="1" OpCodesInError=”0” >
<OpCodeResult OpCode="EAI" Status="0" Message="OK" >
<ResultRow>
<AttachmentKey>123456</AttachmentKey>
</ResultRow>
</OpCodeResult>
</APIResults>
Potential Error Codes
Error |
Message |
Reason |
---|---|---|
80 |
Event Not Found! |
The function could not find a matching event entry based on the values supplied in EventKey, EventCode, and EventDescription. |
81 |
Attachment Must Have A Filename or Description! |
Either the AttachmentDescription must be supplied, or the file is uploaded via the multi-part form post must have a filename attribute. |
82 |
Invalid Subject Category Specified! |
The AttachmentSubjectCategoryKey was specified and is invalid. |