up Version >= 1

Transactions Download

Once authorised, a client can download transactions belonging to any of its sites via the TWeb Public API. Transactions are returned in a JSON list. The process of downloading transactions may involve three requests to the Public API:

  1. A request to obtain a batch number for the download
  2. Requests to obtain the transactions for the batch
  3. Requests to tag transactions as received (this is optional)

When the client makes a request to obtain the batch number (Step 1) it also submits filters to specify which transactions are to be included in the batch. Once the client receives the batch number, then it can use this number to make multiple requests to obtain transactions for the batch (Step 2). Each request is limited to a maximum of 100 records and the client must specify the start and end indexes for the transactions to be downloaded. After each set of transactions have been received and correctly stored (Step 2), the client may wish to tag the transactions as received (Step 3). The tag status of a transaction can be used as a filter during Step 1. This is useful if a client simply wants to download any transactions it has not previously received.

Step 1 - Requesting a Transactions Batch Number

The endpoint depends on the server used by your company to login to TWeb:

T-WEB Server T-WEB Login URL API Endpoint
www https://www.tweb.com.au/v2/ https://publicapi.tweb.com.au/v1/TransactionsBatchNumber
www2 https://www2.tweb.com.au/v2/ https://publicapi2.tweb.com.au/v1/TransactionsBatchNumber
gt https://gt.tweb.ttfuel.com/v2/ https://publicapi.gt.tweb.ttfuel.com/v1/TransactionsBatchNumber
uae https://uae.tweb.ttfuel.com/v2/ https://publicapi.uae.tweb.ttfuel.com/v1/TransactionsBatchNumber

The endpoint only accepts HTTP POST requests. The following POST parameters must be included with the request:

accessToken

Note that the Access Token may be submitted as a POST parameter or as a HTTP Cookie.

The following POST parameters may optionally be submitted with the request:

targetID
filterStartDatetime
filterEndDatetime
filterTaggedTransactions
filterSiteNumber

For details regarding the Target ID, please refer to the following article: https://help.tweb.com.au/TWebPublicAPI/en/Authorisation/Execute#heading_request

filterStartDatetime is an optional POST parameter. This parameter specifies the lower time-limit (inclusive) for transactions included in the batch. For example, if set to 11:59PM on 31 Jan 2018 then only transactions occurring on and after this date and time will be included in the batch. The filterStartDatetime has the following validation rule specifications:

Rule Specification
Format yyyy-MM-dd HH:mm:ss (eg. 2018-01-31 23:59:00, which would mean 11:59PM on 31 Jan 2018)
Parsing The date and time must be valid
Default When this parameter is not specified, it value defaults to 1900-01-01 00:00:00

filterEndDatetime is an optional POST parameter. This parameter specifies the upper time-limit (inclusive) for transactions included in the batch. For example, if set to 11:59PM on 31 Jan 2018 then only transactions occurring before and on this date and time will be included in the batch. The filterEndDatetime has the following validation rule specifications:

Rule Specification
Format yyyy-MM-dd HH:mm:ss (eg. 2018-01-31 23:59:00, which would mean 11:59PM on 31 Jan 2018)
Parsing The date and time must be valid
Default When this parameter is not specified, it value defaults to 3000-01-01 00:00:00

filterTaggedTransactions is an optional POST parameter. This parameter specifies whether to return transactions that have previously been downloaded via the Public API or not. It has the following validation rule specifications:

Rule Specification
Allowed values TaggedAndUntagged, UntaggedOnly, TaggedOnly
Default TaggedAndUntagged

filterSiteNumber is an optional POST parameter. This parameter specifies the site where transactions occurred. Site Numbers are allocated to all sites by TT. A list is available via TWeb. This filter has the following validation rule specifications:

Rule Specification
Format /[0-9]{6}/, eg. 123456
Default When this parameter is not specified then transactions for all sites will be returned

Request Examples

A request for the Batch Number that includes the Access Token from the file where it was stored during authorisation:

curl -b cookiejar.txt -skX POST -d "targetID=abc123&filterStartDatetime=2018-01-31 23:59:00&filterEndDatetime=2018-03-01 00:00:00&filterTaggedTransactions=UntaggedOnly&filterSiteNumber=123456" https://publicapi.tweb.com.au/v1/TransactionsBatchNumber

A request for the Batch Number that includes the Access Token as a POST parameter in the body:

curl -skX POST -d "accessToken=0123456789ABCDEF0123456789ABCDEF01234567&targetID=abc123&filterStartDatetime=2018-01-31 23:59:00&filterEndDatetime=2018-03-01 00:00:00&filterTaggedTransactions=UntaggedOnly&filterSiteNumber=123456" https://publicapi.tweb.com.au/v1/TransactionsBatchNumber

Step 1 - Response

The response from the Batch Number endpoint has the following JSON format:

{
"Data": {
"Items": [
{
"NewBatchNumber": 123
}
],
"Meta": {
"Endpoint": "/v1/TransactionsBatchNumber",
"SubmittedFilters": {
"filterEndDatetime": "2018-03-01 00:00:00",
"filterSiteNumber": "123456",
"filterStartDatetime": "2018-01-31 23:59:00",
"filterTaggedTransactions": "UntaggedOnly"
},
"TargetID": "abc123",
"Title": "Public API: Transactions Batch Number",
"TotalRecords": 1000
}
},
"Error": {
"Code": 0,
"Status": "OK"
}
}

The batch number is an integer and is available in the Data.Items[0].NewBatchNumber JSON property.

The total number of transactions for the given filters is also an integer and is available in the Data.Meta.TotalRecords JSON property.

The Error JSON property is included in all responses from the TWeb Public API. The possible responses when requesting a Transactions Batch Number are:

Error Code Error Name Explanation
0 OK A Batch Number has been assigned and returned.
1 Server Error This issue either does not fit any of the other codes or is due to a bug in the Public API code.
4000 Rate Limit Exceeded This is the second request within a 1 second period.
4002 Account Inactive Account Inactive.
4003 Session Expired Session Expired.
4008 Invalid Access Token The Access Token was not valid.
4104 Invalid Target ID The Target ID did not conform to the specifications.
4105 Invalid Filter One of the submitted filters was invalid. The Error.Status JSON property will specify which filter was incorrect.
4200 Unable To Allocate Batch Number There was an error while attempting to generate a new Batch Number.
4201 Unable To Assign Transactions To Batch Number There was an error while attempting to allocate transactions to a Batch Number.

Step 2 - Requesting a Page of Transactions

Public API Version: 

Once the client has the Transactions Batch Number, this can be used to download transaction data. The endpoint used for this depends on the server used by your company to login to TWeb:

T-WEB Server T-WEB Login URL API Endpoint
www https://www.tweb.com.au/v2/ https://publicapi.tweb.com.au/v1/Transactions https://publicapi.tweb.com.au/v1.1/Transactions https://publicapi.tweb.com.au/v1.2/Transactions https://publicapi.tweb.com.au/v1.3/Transactions
www2 https://www2.tweb.com.au/v2/ https://publicapi2.tweb.com.au/v1/Transactions https://publicapi2.tweb.com.au/v1.1/Transactions https://publicapi2.tweb.com.au/v1.2/Transactions https://publicapi2.tweb.com.au/v1.3/Transactions
gt https://gt.tweb.ttfuel.com/v2/ https://publicapi.gt.tweb.ttfuel.com/v1/Transactions https://publicapi.gt.tweb.ttfuel.com/v1.1/Transactions https://publicapi.gt.tweb.ttfuel.com/v1.2/Transactions https://publicapi.gt.tweb.ttfuel.com/v1.3/Transactions
uae https://uae.tweb.ttfuel.com/v2/ https://publicapi.uae.tweb.ttfuel.com/v1/Transactions https://publicapi.uae.tweb.ttfuel.com/v1.1/Transactions https://publicapi.uae.tweb.ttfuel.com/v1.2/Transactions https://publicapi.uae.tweb.ttfuel.com/v1.3/Transactions

The endpoint only accepts HTTP POST requests. The following POST parameters must be included with the request:

accessToken
batchNumber
startRecord
endRecord

And the following POST parameters may optionally be submitted with the request:

targetID

Note that the Access Token may be submitted as a POST parameter or as a HTTP Cookie.

The Start Record specifies the record number to begin transaction downloads at. Note that the count begins at 1, not 0, and is inclusive. For example, if set to 1 then transaction record 1 in the batch will be returned as the first record in the result set. The Start Record has the following validation rule specifications:

Rule Specification
Format Integer
Minimum value 1
Maximum value TotalRecords

The End Record specifies the record number to begin transaction downloads at. Note that the count begins at 1, not 0, and is inclusive. For example, if set to 1 then transaction record 1 in the batch will be returned as the last record in the result set. The End Record has the following validation rule specifications:

Rule Specification
Format Integer
Minimum value 1
Maximum value TotalRecords

Furthermore, the Start Record and End Record must satisfy the following condition: (endRecord - startRecord) < 100. Because the start and end records are inclusive, 100 transactions can be downloaded by setting startRecord=1 and endRecord=100 (not 99 transactions!).

Request Examples

A request for Transaction data that includes the Access Token from the file where it was stored during authorisation:

curl -b cookiejar.txt -skX POST -d "targetID=abc123&batchNumber=123&startRecord=1&endRecord=1" https://publicapi.tweb.com.au/v1/Transactions
curl -b cookiejar.txt -skX POST -d "targetID=abc123&batchNumber=123&startRecord=1&endRecord=1" https://publicapi.tweb.com.au/v1.1/Transactions
curl -b cookiejar.txt -skX POST -d "targetID=abc123&batchNumber=123&startRecord=1&endRecord=1" https://publicapi.tweb.com.au/v1.2/Transactions
curl -b cookiejar.txt -skX POST -d "targetID=abc123&batchNumber=123&startRecord=1&endRecord=1" https://publicapi.tweb.com.au/v1.3/Transactions

A request for Transaction data that includes the Access Token as a POST parameter in the body:

curl -skX POST -d "targetID=abc123&accessToken=0123456789ABCDEF0123456789ABCDEF01234567&batchNumber=123&startRecord=1&endRecord=1" https://publicapi.tweb.com.au/v1/Transactions
curl -skX POST -d "targetID=abc123&accessToken=0123456789ABCDEF0123456789ABCDEF01234567&batchNumber=123&startRecord=1&endRecord=1" https://publicapi.tweb.com.au/v1.1/Transactions
curl -skX POST -d "targetID=abc123&accessToken=0123456789ABCDEF0123456789ABCDEF01234567&batchNumber=123&startRecord=1&endRecord=1" https://publicapi.tweb.com.au/v1.2/Transactions
curl -skX POST -d "targetID=abc123&accessToken=0123456789ABCDEF0123456789ABCDEF01234567&batchNumber=123&startRecord=1&endRecord=1" https://publicapi.tweb.com.au/v1.3/Transactions

Step 2 - Response

The response from the Transactions endpoint has the following JSON format:

{
"Data": {
"Items": [
{
"ActivityCard": {
"Number": "0000000000007890",
"AccountNumber: "99778",
}
"Amount": 500.0,
"CardAccessID": {
"Number": "0000000000001234",
"AccountNumber": "88123",
"MapCode": 123
},
"CustomerReferenceNumber": "",
"DateTime": "2018-03-01T00:00:00",
"CostCentre": "ZzYyXx98765",
"Discount": 0,
"Grade": {
"Number": 2,
"Name": "Unleaded"
},
"Hose": 1,
"Odometer": 0,
"PLU": "",
"PromotionCode": "",
"Pump": 1,
"Quantity": 500.0,
"Reference": 0,
"SKU": "",
"Site": {
"Number": 123456,
"LocationCode": "XYZ"
},
"Vehicle": {
"Registration": "ABC123",
"AssetNumber": "AA998877",
"FleetNumber": "FF112233",
"Name": "TT_ABC123"

},
"Surcharge": 0,
"TotalEngineHours": 0.0,
"UnderLoadHours": 0.0,
"UnitPrice": 1.0,
"UserID": "",
"RowNumber": 1
}
],
"Meta": {
"Endpoint": "/v1.21.3/Transactions",
"SubmittedFilters": {
"batchNumber": 123,
"endRecord": 1,
"startRecord": 1
},
"TargetID": "abc123",
"Title": "Public API: Download Transactions"
}
},
"Error": {
"Code": 0,
"Status": "OK"
}
}
{
"Data": {
"Items": [
{
"ActivityCardNumber": "",
"Amount": 500.0,
"CardNumber": "0000000000001234",
"CustomerReferenceNumber": "",
"DateTime": "2018-03-01T00:00:00",
"CostCentre": "ZzYyXx98765",
"Discount": 0,
"Grade": {
"Number": 2,
"Name": "Unleaded"
},
"Hose": 1,
"MapCode": 0,
"Odometer": 0,
"PLU": "",
"PromotionCode": "",
"Pump": 1,
"Quantity": 500.0,
"Reference": 0,
"SKU": "",
"Site": {
"Number": 123456,
"LocationCode": "XYZ"
},
"Vehicle": {
"Registration": "ABC123",
"AssetNumber": "AA998877",
"FleetNumber": "FF112233"
},
"Surcharge": 0,
"TotalEngineHours": 0.0,
"UnderLoadHours": 0.0,
"UnitPrice": 1.0,
"UserID": "",
"RowNumber": 1
}
],
"Meta": {
"Endpoint": "/v1.1/Transactions",
"SubmittedFilters": {
"batchNumber": 123,
"endRecord": 1,
"startRecord": 1
},
"TargetID": "abc123",
"Title": "Public API: Download Transactions"
}
},
"Error": {
"Code": 0,
"Status": "OK"
}
}
{
"Data": {
"Items": [
{
"ActivityCardNumber": "",
"Amount": 500.0,
"CardNumber": "0000000000001234",
"CustomerReferenceNumber": "",
"DateTime": "2018-03-01T00:00:00",
"Discount": 0,
"Grade": {
"GradeNum": 2,
"Name": "Unleaded"
},
"Hose": 1,
"MapCode": 0,
"Odometer": 0,
"PLU": "",
"PromotionCode": "",
"Pump": 1,
"Quantity": 500.0,
"Reference": 0,
"SKU": "",
"SiteNumber": 123456,
"Surcharge": 0,
"TotalEngineHours": 0.0,
"UnderLoadHours": 0.0,
"UnitPrice": 1.0,
"UserID": "",
"RowNumber": 1
}
],
"Meta": {
"Endpoint": "/v1/Transactions",
"SubmittedFilters": {
"batchNumber": 123,
"endRecord": 1,
"startRecord": 1
},
"TargetID": "abc123",
"Title": "Public API: Download Transactions"
}
},
"Error": {
"Code": 0,
"Status": "OK"
}
}

The transaction data is returned as a list of objects in Data.Items. Each of the properties of that object are described in the following table:

Property Description
ActivityCardNumberActivityCard.Number The activity card number that was used to discount an EFTPOS transaction expressed as the full PAN. Can be an empty string. Only the following characters are valid: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
ActivityCard.AccountNumber The Account Number from which the account the activity card belongs to
Amount The monetary value of the transaction.
CardNumberCard.NumberAccessID.Number The Access ID Number that was supplied when the transaction was authorised. Can be an empty string. Only the following characters are valid: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
Card.AccountNumberAccessID.AccountNumber The Account Number from which the account the Access ID belongs to
Card.MapCodeAccessID.MapCode The Map Code for the Access ID Number. This value is always an integer. Refer to the following T-WEB Help article to derive the Access ID Type from the Access ID Map Code - Requesting Access ID Types.
CustomerReferenceNumber A third party (i.e. customer) reference number that was supplied when the transaction was authorised. Can be an empty string. Only the following characters are valid: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
DateTime The transaction date and time, formatted as yyyy-MM-dd HH:mm:ss.
CostCentre The cost centre of the transaction.
Discount The discounted amount of the transaction.
Grade.GradeNumGrade.Number The grade number of the fuel.
Grade.Name The name of the fuel.
Hose The number of the hose that the fuel was dispensed from.
MapCode The Map Code for the Access ID Number. This value is always an integer. Refer to the following T-WEB Help article to derive the Access ID Type from the Access ID Map Code - Requesting Access ID Types.
Odometer The vehicle odometer reading. Can be zero.
PLU The price lookup code. Can be an empty string. Only the following characters are valid: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
PromotionCode The promotion code. Can be an empty string. Only the following characters are valid: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
Pump The number of the pump that the fuel was dispensed from.
Quantity The quantity of liquid dispensed for this transaction.
Reference A Controller-assigned auto-incrementing transaction reference number in the range 0-9999. The number wraps at 9999 and begins again at 0.
SKU The stock keeping unit code. Can be an empty string. Only the following characters are valid: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
SiteNumber The Controller's Site ID. This numerical value is allocated by Transponder Technologies.
Site.Number The Controller's Site ID. This numerical value is allocated by Transponder Technologies.
Site.LocationCode The Controller's Location Code. This alphanumeric value is allocated by the owner of the site.
Vehicle.Name The vehicle name.
Vehicle.Registration The vehicle registration number.
Vehicle.AssetNumber The vehicle asset number.
Vehicle.FleetNumber The vehicle fleet number.
Surcharge The surcharged amount of the transaction.
TotalEngineHours The vehicle total engine hours since it was built. Can be zero.
UnderLoadHours The vehicle engine hours while the vehicle is moving. Can be zero.
UnitPrice The transaction unit price, i.e. the cost per unit of fuel for this transaction.
UserID The User ID that was supplied when the transaction was authorised. Can be an empty string. Only the following characters are valid: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
RowNumber The Row Number that the transaction corresponds to.

The Error JSON property is included in all responses from the TWeb Public API. The possible responses when requesting Transaction data are:

Error Code Error Name Explanation
0 OK Transactions have been returned
1 Server Error This issue either does not fit any of the other codes or is due to a bug in the Public API code.
4000 Rate Limit Exceeded This is the second request within a 1 second period.
4002 Account Inactive Account Inactive.
4003 Session Expired Session Expired.
4008 Invalid Access Token The Access Token was not valid.
4100 Invalid Record Count The specified number of records did not match the number of records found in the database.
4104 Invalid Target ID The Target ID did not conform to the specifications.
4101 Invalid Start Record The start record was not valid.
4102 Invalid End Record The end record was not valid.
4103 Invalid Page Size The start and end records resulted in more than 100 records.
4202 Invalid Batch Number The Batch Number was not valid.

Step 3 - Tagging Transactions

Once the client has the Transactions Batch Number, this can be used to tag transactions as received. The endpoint used for this depends on the server used by your company to login to TWeb:

T-WEB Server T-WEB Login URL API Endpoint
www https://www.tweb.com.au/v2/ https://publicapi.tweb.com.au/v1/TagTransactions
www2 https://www2.tweb.com.au/v2/ https://publicapi2.tweb.com.au/v1/TagTransactions
gt https://gt.tweb.ttfuel.com/v2/ https://publicapi.gt.tweb.ttfuel.com/v1/TagTransactions
uae https://uae.tweb.ttfuel.com/v2/ https://publicapi.uae.tweb.ttfuel.com/v1/TagTransactions

The endpoint only accepts HTTP POST requests. The following POST parameters must be included with the request:

accessToken
batchNumber
startRecord
endRecord

And the following POST parameters may optionally be submitted with the request:

targetID

These POST paramters are identical to those from Step 2, and the same validation rules apply.

Request Examples

A request for Transaction data that includes the Access Token from the file where it was stored during authorisation:

curl -b cookiejar.txt -skX POST -d "targetID=abc123&batchNumber=123&startRecord=1&endRecord=1" https://publicapi.tweb.com.au/v1/TagTransactions

A request for Transaction data that includes the Access Token as a POST parameter in the body:

curl -skX POST -d "targetID=abc123&accessToken=0123456789ABCDEF0123456789ABCDEF01234567&batchNumber=123&startRecord=1&endRecord=1" https://publicapi.tweb.com.au/v1/TagTransactions

Step 3 - Response

The response from the Transactions endpoint has the following JSON format:

{
"Error": {
"Code": 0,
"Status": "OK"
},
"Data": {
"Meta": {
"TargetID": "abc123",
"Title": "Public API: Tag Transactions",
"Endpoint": "/v1/TagTransactions",
"SubmittedFilters": {
"batchNumber": 123,
"startRecord": 1,
"endRecord": 1
}
},
"Items": []
}
}

The Error JSON property indicates whether the transaction tagging was successful or not. The possible responses when requesting Transaction data are the same as in Step 2, with one additional possible Error response:

Error Code Error Name Explanation
4203 Unable To Tag All Transactions Some transactions could not be tagged. Note that when this error occurs then the status will indicate how many transactions were actually tagged, but not which ones.