Perform Batch Payments by REST API

Any issue about Cyclos 4 scripting and Webservices

Moderators: hugo, alexandre, rmvanarkel

Post Reply
jar
Posts: 98
Joined: Mon Apr 20, 2015 8:55 am

Perform Batch Payments by REST API

Post by jar » Mon Mar 18, 2019 3:14 pm

Hi,

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.

Thanks.
Jar
Thanks for your kind attention.
Best regards,

JAR

admin
Site Admin
Posts: 1413
Joined: Mon Jan 24, 2005 10:31 am

Re: Perform Batch Payments by REST API

Post by admin » Tue Mar 19, 2019 2:20 pm

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"
},
"dXNlcixhbW91bnQKYzEsMTAwCmMyLDExMApjMywxMAo=",
"1234"
]

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

jar
Posts: 98
Joined: Mon Apr 20, 2015 8:55 am

Re: Perform Batch Payments by REST API

Post by jar » Thu Mar 21, 2019 1:12 pm

Thanks
Thanks for your kind attention.
Best regards,

JAR

Post Reply