Page 1 of 1

Perform Batch Payments by REST API

Posted: Mon Mar 18, 2019 3:14 pm
by jar

I would like to know if i can make a batch payments by REST API?
I tried perform the payment through payment API, but I couldn't figure it out how import the csv file.


Re: Perform Batch Payments by REST API

Posted: Tue Mar 19, 2019 2:20 pm
by admin
Bulk import is currently not available in the REST API, you could perform a bulk action making payments one by one.
You can also use the RPC API this way:

Send a POST to <cyclos-root>/web-rpc/import/upload, sending the regular authentication headers (for example, basic auth or Session-Token / Access-Client-Token headers), and with following JSON on the body:
"class": "org.cyclos.model.system.imports.UserPaymentImportedFileDTO",
"paymentType": "userUnits.tradeTransfer",
"user": "self",
"processAutomatically": true,
"fileName": "batch-payments.csv"

It is an array with 3 parameters:
A JSON object with that specific class, a payment type (account internal name.payment type internal name) and a given file name (can be always the same)
Base64-encoded content of the imported file. In this case, is a simple CSV with 2 columns: user, amount, Could also have description and custom fields
The confirmation password, or null / empty if not used

Re: Perform Batch Payments by REST API

Posted: Thu Mar 21, 2019 1:12 pm
by jar