Child pages
  • Transaction
Skip to end of metadata
Go to start of metadata

Description

 

The Transaction API allows Users to execute multiple SaveDocument and DeleteDocument actions at once. More importantly, it gives Users the ability to execute these actions transactionally, i.e. if one of the actions in the request fails to successfully execute, then the rest of the actions will be rolled back as well.

The maximum number of actions included in one transaction is 10.

 

Specific Request Parameters

(Refer to Common Request Parameters)

Name

Description

Required

Default

Possible Values

apsdb.store

The store name of the store on which to execute.

No

DefaultStore

 

action.[actionNumber].apsdb.type

The type of the action that it will execute (such as "SaveDocument", "DeleteDocument")

Yes

 

SaveDocument DeleteDocument

action.[actionNumber].apsdb.documentKey

The universally unique document identifier


No (if SaveDocument )_
_

Yes (if DeleteDocument )

 

 

action.[actionNumber].apsdb.update

Whether or not to create a new document if an existing document with the same “apsdb.documentKey” is found

 

false

true
false

action.[actionNumber].apsdb.ftsFields

Comma separated list of fields to index. If sent empty, nothing will be indexed.

 

 

 

action.[actionNumber].apsdb.multivalueAppend

Specifies which field value will be appended instead of being replaced for multivalue fields<br /> Contains a comma separated list of fields to append

 

 

 

action.[actionNumber].[fieldName]

This parameter name in the request is the name of the field to be stored, and its value is the value of the field to be stored

Yes

 

 

action.[actionNumber].apsdb.fieldType

Specifies the type of the field

 

string

string
numeric
date
text

action.[actionNumber].apsdb.fieldDateFormat

The format of the date field.Default value is "MM/dd/yyyy HH:mm:ss".

 

 

 

Specific Response Elements

(Refer to Common Response Elements)

The following specific "result" element is a child of the common root element "response" and a sibling of the common "metadata" element:

{
	"result": {
		"actions": [
			{
				"actionNumber": "1",
				"result": {
					"document": {
						"key": "the key of a document created by invoking the SaveDocument API within a transaction"
					}
				}
			},
			{
				"actionNumber": "2",
			},
			{
				"actionNumber": "n",
			}
		]
	}
}
 

Note: Action elements with no corresponding result element represent invocations to DeleteDocument API within a transaction.

Specific Logical Errors

(Refer to Common Logical Error Codes)

Error

Message

Status Code

STORE_NOT_FOUND

The store was not found

404

DOCUMENT_NOT_FOUND

The document with “document_key” “[documentKey]” could not be found for update

404

NO_ACTIONS_REQUESTED

No action.1.apsdb.type parameter was found, so no actions can be executed.

400

Examples

Sample Request

Request URL: http://sandbox.apstrata.com/apsdb/rest/[authenticationkey]/Transaction?apsws.time=[timestamp]&apsws.authSig=[signature] 



POST parameters:

apsdb.store=ClevelandMain
action.1.apsdb.documentKey=docKey1
action.1.apsdb.type=DeleteDocument
action.2.apsdb.documentKey=docKey2
action.2.apsdb.type=SaveDocument
action.2.field1=10
action.2.field1.apsdb.fieldType=numeric 



Sample XML Response

Success XML:

<response xmlns="http://www.apstrata.com/services/schemas/apstrata_database_response.xsd">
  <metadata>
    <requestId>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</requestId>
    <status>success</status>
  </metadata>
  <result>
    <actions>
      <action actionNumber="1"/>
	<action actionNumber="2"/>
	  <result>
    <document key="docKey2"/>
        </result>
	</action>
    </actions>
  </result>
</response>



Failure XML:

<response xmlns="http://www.apstrata.com/services/schemas/apstrata_database_response.xsd">
    <metadata>
        <requestId>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</requestId>
        <status>failure</status>
        <errorCode>[errorCode]</errorCode>
        <errorDetail>[failMsg]</errorDetail>
    </metadata>
</response>



Sample JSON Response

{"response": {
  "metadata": {
    "requestId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "status": "success"
  },
    "result": {
    "actions": [
      {
        "actionNumber": "1"
      },
      {
        "actionNumber": "2",
        "result": {
          "document": {
            "key": "docKey2"
          }
        }
      }
    ]
  }
}}


 

 

  • No labels