Batches 👑

Batch operations are used to make multiple one type operations with one request.

This endpoint is only available for our GURU customers only 👑

Currently, the following operations can be executed in batches :

  • Bulk Cashback

  • Bulk Redeem

  • Bulk Balance Inquiry

Each batch is limited to a max of 1000 entries per batch.

Using the batch API is simple as it provides unified interfaces to execute any of the above supported operations. It can be used to run async batches and track them in your system.

To start a batch operation, you need to start a batch request via the Start Batch API. You can then keep checking the status of a batch operation started via its Batch ID. The status of the batch can be one of the following

Status

Description

Queued

Batch is received but not started

Running

Batch is in progress

Completed

All batch operations are completed

Stopped

Batch stopped

Once the batch status is finished, you will be able to check the batch operation outcome including total processed, total failed, and return body object if any.

Available Endpoints

Type

Description

Endpoint

POST

/integrations/batch

GET

/integrations/batch/:batchId

DELETE

/integrations/batch/:batchId

POST- Start Batch Operation

https://api.gameball.co/api/v3.0/integrations/batch

This API call is used to efficiently perform multiple operations within a single HTTP request, Instead of sending individual requests for each operation.

Request

Attribute

Type

Required

Description

APIKey

string

Yes

Client API key

SecretKey

string

Yes

Client Secret key/transaction key

Body

Attribute

Type

Required

Description

method

string

Yes

The HTTP method to use for the operation. Possible values:

  • "GET"

  • "POST"

  • "PUT"

  • "PATCH"

operation

string

Yes

Name of the operation to be performed. Possible values are

  • cashback

  • redeem

  • balance

params

integer

No

Optional request query parameters.

body

array

Yes

An array of objects to use with the request. Each operation has its own body

For more information on body object format check Batch Operations Data

{
   "method":"POST",
   "operation":"cashback",
   "params":{},
   "body":{
[
   {
      "playerUniqueId":"Player1",
      "transactionId":"tra_156473",
      "transactionTime":"2021-07-25T14:22:42.097Z",
      "amount":100
   }
]
}

Response

Parameter

Type

Description

batchId

string

Batch id to be used to get the status of the created batch

Usage Example

curl -X POST -H 'apiKey: 807b041b7d35425988e354e1f6bce186' \
       -H 'secretKey: klmb041b7d354259l3u4ft35e1q2r3703'
       -d '{
            "method":"POST",
            "operation":"cashback",
            "params":{
               "name":"mike"
            },
            "body":{}
         }'
 -v -i 'https://api.gameball.co/api/v3.0/integrations/batch'

GET- Get Batch Operation

https://api.gameball.co/api/v3.0/integrations/batch/:batchId

This API call is used to fetch the results and status of a batch operation.

Request

Header

Attribute

Type

Required

Description

APIKey

string

Yes

Client API key

SecretKey

string

Yes

Client Secret key\transaction key

Path Parameters

Parameter

Type

Required

Description

batchId

string

Yes

Batch operation ID

Response

Body

Attribute

Type

Description

operation

string

Name of the operation to be performed. Possible values are :

  • cashback

  • redeem

  • balance

errorCount

integer

The count of items with errors in batch.

totalCount

integer

The count of items in batch

finishedCount

integer

The count of processed items in batch

startedAt

datetime

Batch operations start time in UTC. format. Example: 2017-05-30T15:14:22Z

createdAt

datetime

Batch operations creation time in UTC. format. Example: 2017-05-30T15:14:22Z

status

string

Batch operation status:

  • Queued

  • Running

  • Completed

  • Stopped

response

object

Result of operation (JSON object)

{
   "method":"POST",
   "operation":"cashback",
   "errorCount":0,
   "totalCount":100,
   "finishedCount":60,
   "startedAt":"2012-12-30 16:50:11",
   "createdAt":"2012-12-30 16:50:11",
   "status":"Running",
   "response":{}
}

Usage Example

curl -X GET -H 'apiKey: 807b041b7d35425988e354e1f6bce186' \
       -H 'secretKey: klmb041b7d354259l3u4ft35e1q2r3703'
 -v -i 'https://api.gameball.co/api/v3.0/integrations/batch/213'

DELETE- Stop Batch Operation

https://api.gameball.co/api/v3.0/integrations/batch/:batchId

This API call is to halt the execution of a running batch operation.

Request

Header

Attribute

Type

Required

Description

APIKey

string

Yes

Client API key

SecretKey

string

Yes

Client Secret key\transaction key

Path Parameters

Parameter

Type

Required

Description

batchId

string

Yes

Batch operation ID

Usage Example

curl -X DELETE -H 'apiKey: 807b041b7d35425988e354e1f6bce186' \
       -H 'secretKey: klmb041b7d354259l3u4ft35e1q2r3703'
 -v -i 'https://api.gameball.co/api/v3.0/integrations/batch/213'

Last updated