Start a conversation

Account

1) account/add-to-tree

A method that adds an account to the specified tree. As a result, the position is formed.

Method - POST

https://.../online-office/account/add-to-tree

Request parameters

Parameter Type Mandatory field Note
accountID Integer Yes Account ID, which for you need to create a position in the tree

sponsorPositionId Integer Yes Sponsor position ID
treeId Integer Yes Tree ID


2) account/get-all-data

Method to get various account data.

Now you can get the following data:
- profile fields [prefix "p."]
- marketing properties [prefix "m."]
- wallet balances [prefix "w."]
- system properties [prefix "s."] (for account_id)

Method - POST

Request parameters

Field Type Mandatory field Note
ids
Integer|array
Yes id, for which you need to download information, one or a list
properties
Array
Yes, if none of the flags are specified
Properties to load for the specified id ["p.firstname", "w.Virtual_wallet", "m.PV"]
type
Integer
No The type of id sent. Could be 'accounts' or 'positions'. The default is 'accounts'.
dataProfile
Boolean
No Flag indicating that all profile fields must be loaded.
dataMarketing
Boolean No Flag indicating that all marketing properties must be loaded.
dataWallets
Boolean No Flag indicating that you need to load balances for all wallets

The flags dataProfile, dataMarketing, dataWallets can be used in conjunction with the list of properties.

        The answer is formed in a format allowing not to duplicate the attributes of the loaded properties of type title. The answer contains:

  • id type for which data were loaded
  • a property map that contains information about loaded fields but not their values
  • the loaded information for each transferred id, in a format convenient for the client

3) account/get-branch

https://.../main-app/account/get-branch

Parameter Type Mandatory field Default value Note
accountId int no   Id account to get ancestors
positionId int yes   Position to get upline
rootPositionId int no   Position to get ancestors
showRoot boolean no true Whether to show the root position in the result (only if rootPositionId or accountId is specified)
showSponsor boolean no false Whether to show the sponsor's position in the result (only if showRoot = true is specified and rootPositionId or accountId is specified)


4) account/get-downline

Request parameters

Field Type Mandatory field Note
accountId
Int
Yes This field is required if the parentId parameter is not passed.
treeId
Int
No The default is 0 - Genealogy. This parameter makes sense to pass along with accountId
offset
Int
No The default is 1. This parameter makes sense to pass along with accountId.
parentId
Int
Yes This field is required if the parentId parameter is not passed.
perPage
Int No Number of records returned - page size. Default 50, but not more than 100
pageNumber
Int No Page number. Numeration starts from 1. The default is 1

depth
Int No Depth of the tree opening. Only one level is returned by default.
showSponsor
Boolean No Whether to show the sponsor for the specified position, i.e. whether to return in the response data on parent parentId from which the search is conducted. Default is false

showRoot
Boolean No Whether to show the root, i.e. whether to return in the response data on parentId from which the search is conducted. Default is false


5) account/get-downline-grid

The method returns a subtree for the specified account / position in the form of a table

Request parameters


Field Type Mandatory field Note
depth
integer
no Depth of disclosure of a tree. By default, only one level is returned.

perPage
integer
no Number of records returned - page size. The default is 50, but not more than 100
filter
array
no Array of filters. For each element, several fields are set: field, operation, value
pageNumber
integer
no Page number. Numbering starts at 1. The default is 1
orderBy
array
no Sort option [field1 => direction, field2 => direction, ...] where direction is one of the ASC / DESC options (in capital letters)
treeId
integer
no The default is 0 - Genealogy. This parameter makes sense to pass along with accountId
offset
integer
no The default is 1. This parameter makes sense to pass along with accountId
parentId
integer
yes This field is required if the accountId parameter is not passed
accountId
integer
yes This field is required if parentId is not passed.

Parameters for filtering and sorting are specified in the form p.ProfileFieldAlias, m.MarketingPropertyAlias for profile fields and marketing properties, as well as from an array that correspond to table fields.

Because This request is made by the GET method, then all parameters must be encoded in the URL.
      In PHP, this is done with the function http_build_query ($ params), where $ params is an array of request parameters.
      As a result, we get such a request for api:


api2.local/api2/main-app/account/get-downline-grid?accountId=1&pageNumber=1&filter%5B0%5D%5Bfield%5D=s.account_id&filter%5B0%5D%5Boperation%5D=%3C&filter%5B0%5D%5Bvalue%5D=20&filter%5B1%5D%5Bfield%5D=p.gender&filter%5B1%5D%5Boperation%5D=%3D&filter%5B1%5D%5Bvalue%5D=male&filter%5B2%5D%5Bfield%5D=m.Downline&filter%5B2%5D%5Boperation%5D=%3C&filter%5B2%5D%5Bvalue%5D=100&orderBy%5Bm.Downline%5D=DESC&orderBy%5Bs.account_id%5D=ASC&orderBy%5Bs.level%5D=DESC


6) account/get-downline-size

The number of people in the structure on the specified tree at the beginning of the period. An array of period-number of people is returned.

Method - POST

Parameter Type Mandatory field Default value Note
accountId int Yes    
tree string No binar Tree alias
periodCount int No 6 Maximum 30
activePeriod
bool No false


7) account/get-info

Method for retrieving various account data

Now you can get the following data:

  • profile fields [prefix "p."]
  • marketing properties [prefix "m."]
  • wallet balances [prefix "w."]
  • system properties [prefix "s."] (as long as account_id)

Request parameters

Field Type Mandatory field Note
ids
int|array
yes id for which you want to load information, one or a list
properties
array of strings
yes, if no flags are specified
Properties to load for the specified id
["p.firstname", "w.Virtual_wallet", "m.PV"]
type
int
no Type of id transferred. May be 'accounts' or 'positions'. The default is 'accounts'.
withProfile
Boolean
no Flag indicating that all profile fields should be loaded
withMarketingData
Boolean no Flag indicating that all marketing properties should be loaded
withWallets
Boolean no Flag indicating that you need to load balances for all wallets

The flags withProfile, withMarketingData, withWallets can be used in conjunction with the properties list.

The response is formed in a format that allows not duplicating the attributes of the loaded properties of type title. The answer contains:

  • type id for which data was loaded
  • a property map that contains information about loaded fields but not their values
  • loaded information for each id transferred, in a format convenient for the client

 Request example

{    "ids": [1,2,3],    "properties": ["m.PV""m.GV""m.Rank""p.firstname""p.lastname","p.email""w.Virtual_wallet"]}


8) account/get-invite-code

The method returns the referral link code for the specified accountId.

Parameter Type Mandatory field
accountId int yes

9) account/get-last-position

The method returns the last left / right position of the tree for the specified account and a list of values of its marketing properties.

Request parameters

Field Type Mandatory field Note
accountId
Int
Yes  
treeId
Int
Yes  


10) account/get-list

The method returns a list of accounts that meet the specified conditions.

URL - https://.../account/get-list

Request parameters

filter
Array
Yes An array of objects. Each object contains three fields: field, operation and value.
  • field - string. Acceptable values:       
    • createdAt - account creation date
  • operation - string.  Type of comparison operation. Acceptable values:
  • value - string or array consisting of two elements in the case of using the comparison operation between
orderBy
String
No String format







field 1 sorting_type[, field2 sorting_type]
If there are several fields, they are separated by commas.
       Acceptable fields for sorting:
  • id 
  • title
  • createdAt
Acceptable sorting types: ASC or DESC
An example to sort by two fields







createdAt DESC, title ASC
perPage
Integer No Number of records returned - page size. Default is 50, but not more than 100
pageNumber
Integer No Page number. Numbering starts from 1. The default is 1

Request examples

<!— After the specified date ->
https://drupal.mlm-soft.com/api2/basic/account/get-list?filter[0][field]=createdAt&filter[0][operation]=>&filter[0][value]=2019/1/1&orderBy=created_at DESC  
<!-- During the period ->
https://drupal.mlm-soft.com/api2/basic/account/get-list?filter[0][field]=createdAt&filter[0][operation]=between&filter[0][value][0]=2018/01/01&filter[0][value][1]=2018/12/31&orderBy=title ASC


11) account/get-payment-bills

The method returns a list of requests for payout

Request parameters

Field Type Mandatory field Note
accountId
int
yes id of the account whose requests you want to receive
walletId
int
no wallet id specified in the request
sortBy
string
no Sort parameters:
 order - order id
 date - request creation date
 sum - amount
 status - sort by internal_status field
 If you add '-' to the field, then the sorting will go in the reverse order:
   -order
   -date
   -sum
   -status
perPage
int no Number of records returned - page size. The default is 50, but not more than 100
pageNumber
int no Page number. Numbering starts at 1. The default is 1


12) account/get-payment-personal-data

The method returns personal data for payment.

Request parameters

Parameter Type Mandatory field Default value Note
accountId Integer Yes   Account ID
paymentSystemId Integer Yes   Payment system ID


13) account/get-plan-data

The method returns the values of marketing properties for the account.

Method - POST

Parameter Type Mandatory field Default value Note
accountId int yes    
positionId int no   if not specified, the position is taken from the genealogy
planAlias string yes    
properties array[string,string,...] yes    
periodCount int no 5 20 maximum
activePeriod boolean no false  


14) account/get-positions

The method returns a list of account positions in the specified trees.

Request parameters

Field Type Mandatory field Note
accountId
Integer
yes This field is required if parentId is not passed.
treeId
Integer | massive
no The default is Genealogy id (alias 'genealogy')
withProperties
Boolean no Whether to show the marketing properties of the position in the response. Default = false


15) account/get-property-values

A method that returns marketing property values for account positions.
        The selection is made for the position in the Genealogy, as well as for positions in other trees with the condition offset == 1. The values of the properties in the result set are obtained by merging: the first value used is not NULL.

Request parameters

Parameter Type Mandatory field Default value
accountId Integer Yes  


16) account/get-wallet operations

The method returns a list of operations on the wallet.

Request parameters

Parameter Type Mandatory field Default value Note
accountId Integer Yes    
walletAlias string Yes    
pageNumber Integer No 1  
perPage Integer No 50 Valid values are from 1 to 100


17) account/get-wallets-balance

The method returns the balance of existing wallets.

Parameter Type Mandatory field Default value Note
accountId Integer No   If the value is not transferred, a list of wallets without balance will be returned.
date date No current date if the parameter is present, the balance for this date will be calculated, i.e. all transactions are sum up until this date inclusively.


18) account/make-payment

Two logics are implemented in the method:
     - If the walletPay flag is set, then the operation to payout from the specified wallet is performed.
     - If the flag is not set, then the process of fill-up the wallet through the specified external Payment System is initiated.


Method - POST

Request parameters

Parameter Type Mandatory field Note
accountId Integer yes Account id
amount Double yes
Amount
walletTypeId
Integer yes
Wallet type id
paymentSystemId
Integer yes, if walletPay == true Payment system id
walletPay
boolean no Method Logic Control Flag
comment
string yes
This comment is subsequently forwarded to the corresponding entries in kernel_wallet_operation.
returnUrl
string no Page URL, to which the PS will redirect the user after the operation is completed.
changedPlanProperties
array no List of marketing properties for which it is necessary to perform volumeChange via DocLauncher after the operation is completed

After executing the request, the PS returns information in the externalData section.

Field Description
id
Request identifier assigned in the PS
status
Available values:
  • created

  • captured

  • completed

  • error

  • canceled

message
text
reference
Hash transaction authentication string
confirmationUrl
Using this URL, you need to redirect the user to the site of the Payment system


19) account/property-edit

A method that sets the value of a marketing plan property.

Request parameters

Parameter Type Mandatory field Note
accountId Integer Yes Account ID. The field is required if the positionId parameter is NOT passed.
treeId Integer No Tree ID. Default is 0 (Genealogy)
offset Integer No The ordinal position in the tree. Default is 1
positionId Integer Yes Position ID. This field is required if accountId is not passed.
propertyId Integer Yes Property ID
value Double Yes New property value 
folderId Integer No If the folder ID is transferred, the document - the task for changing the volume is added to the existing one, otherwise it will be added to the newly created folder.

20) account/search

The method returns the user profile for the specified account and a list of the values of its marketing properties.
        Method - GET

Field Type Mandatory field Note
accountId
Int
Yes  


21) account/search-by-invite

Search account by referral link.

Method - GET

Parameter Type Mandatory field
inviteCode int yes


22) account/set-invite-code

The method sets invite_code for the specified account.

Method - POST

Parameter
Type
Mandatory field
accountId int yes
inviteCode string yes, from 6 to 100 symbols


23) account/set-payment-personal-data

The method saves personal data for payment.

Method - POST

Request parameters

Parameter

Type
Mandatory field
Default value Note
accountId Integer Yes   Account ID
paymentSystemId Integer Yes   Payment system ID
personalData Array Yes   Personal data


24) account/transfer-to-account

A method for transferring from the wallet of one account to the same wallet of another account. This method is in the list executed through the queue.

Method - POST

To successfully complete this operation, a payment rule with parameters must be set up in the system.
  Source = walletId, Destination = walletId, Source operation type = 10 - out: Account to account transfer, Destination operation type = 9 - in: Account to account transfer.
  The rule can set min / max limits for the transfer amount in walletId wallet currency.In the rule, the commission for this operation can be set as a percentage
  The method response can either be an error or "success": true, data on wallets with current balances and details of the operation.

Request parameters

Parameter Type Mandatory field Note
accountId Integer yes ID of the account whose amount is debited
targetAccountId Integer yes Account ID for which the amount is charged
walletId Integer yes  Wallet Id
amount Double yes Amount in wallet currency


25)account/volume-change

A method that changes the value of a marketing plan property per delta.

        The method can take parameters for changing both one marketing property and several.

Method - POST

Request parameters for changing a single marketing property

Parameter Type Mandatory field Default value Note
accountId Integer Yes    
positionOffset Integer No 0  
pointsAmount Double Yes    
orderId String No   Information field
volumePropertyAlias String No PV If the alias is not transmitted, the default value defined in the system settings is used.
folderId Integer No   If the folder ID is transferred, the document - the task for changing the volume is added to the existing one, otherwise it will be added to the newly created folder.












Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Daria Tsirelnikova

  2. Posted
  3. Updated

Comments