Start a conversation

Introduction to MLM Soft API

Request structure

URL

schema: // host / gateway / entity / method? parameters

Example: http://api2.dev/main-app/payment-system/fill-up/start

In this example:

  • http - schema
  • api2.dev - host
  • main-app - gateway. The gateway determines the type of user (main-app - requests come from the MainApp subsystem)
  • payment-system - entity
  • fill-up/start - method. The name of the method can be complex as in this example (contains slashes)       

Entities in our application:

account, api, country, currency, currency rate, dictionary, metric, payment rule, payment system, period, plan, plan property, profile field, region, rople, schedule, setting, tree, user, wallet.


Available types of methods

GET, POST, DELETE

Request headers

Depends on gateway. See the description of the corresponding gateway

Locale

In each request, you can specify the language in which error messages and informational messages will be returned. To do this, add the parameter `locale` to the request header. Values of this parameter: en_US, ru_RU, etc.

Request example

Token:123
Content-Type:application/json
App-ID:1
Locale:en_US

Request body

Request body example

{  
 "accountId":1,  
 "walletType""USDWallet", 
 "paymentSystem""CardPayGo", 
 "amount": 1,  
 "description""test",
 "context": {   
  "user_id""22", 
  "user_class""admin"  
  }
}

Response structure

Field Type Description Example
errorCode
Integer Error code.
  0 - no error
 
errorMessage
string Error description  
primary
Goal The main goal. If the main goal is achieved, the request is considered successful.
Goal type description see below
Creating a user account in the User table
secondary
Goal[] An array of results to achieve additional goals.
  • Saving a profile in the Profile table in case the data for this have been transferred
  • Save user image if it was transferred
locale
string Locale defining the language in which the message will be returned. Locale can be specified in the request header (see above). By default, the locale is determined by the `defaultLanguage` system configuration parameter. Valid locales are listed in the `language` table. Translations are stored in the `source_message` and` message` tables. You can modify translations in the appropriate  admin section of system
 

Type Goal

Field Type Description
message
string Any string
errors
object[] Array of error message objects. Each object contains the `code` and` message` fields
debug
string[] Array of strings Used in debug mode
payload
object An object containing significant information in case of successful operation
success
bool Flag to achieve the goal


Response example of a successful operation

{    
   "errorCode": 0,    
    "errorMessage"null,  
   "primary": {      
       "success"true,    
       "message""",    
       "payload": {       
           "paymentBillId": 114,      
           "amount": 1,            
           "currencyId""USD",  
           "requestThrough": 1,      
           "redirectUrl"""     
       },        
       "errors": [],  
       "debug": []   
   },    
   "secondary": [],  
   "locale""en_US"
}


Error response example

{    
    "errorCode": 404,  
    "errorMessage""Page not found.", 
    "primary": {      
        "success"false,      
        "message""",      
        "payload"null,      
        "errors": [],        
        "debug": []    
    },    
    "secondary": [],    
    "locale""en_US"
}

One more error response example

{    
     "errorCode": 500,    
     "errorMessage""Validation error", 
     "primary": {        
         "success"false,       
         "message""",        
         "payload"null,       
         "errors": [            
             {                
                  "code"null,            
                  "message""Account Id cannot be blank."  
             }       
         ],        
         "debug": []    
     },    
     "secondary": [],    
     "locale""en_US"
}
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Daria Tsirelnikova

  2. Posted
  3. Updated

Comments