0

What is the format for parameters if I have condition where some parameters can be changed based on another param's value. Eg: I have payment methods: paypal, bank transfer, etc.

+ amount (required, number, `1200`) ... charge amount
+ method (required, string, `paypal`) ... payment method
    + Values
        + `paypal`
        + `bank transfer`
        + `etc`

if method's value is "paypal", then my service need additional param:

+ email (required, string, `user@email.com`) ... user's paypal account

if method's value is "bank transfer", then my service need additional params:

+ bank_name (required, string, `Panama National Bank`) ... user's bank
+ bank_account (required, number, `3445315-XXX`) ... user's bank account
red
  • 117
  • 1
  • 11

1 Answers1

1

I got this answer from username kyle who commented on issue that opened on apiary's GitHub. Below is just copy paste from what Mr.Kyle said.

This isn't possible at the moment, but it is something on our radar and in our roadmap. We're planning to make parameters use MSON, which would allow you to use one of which should allow you to achieve this.

+ Parameters
    + amount: 1200 (number) - Charge Amount
    + One Of
        + Properties
            + method: paypal (required, fixed)
            + email (required)
        + Properties
            + method: bank (required, fixed)
            + `bank_name` (required)
            + `bank_account` (required)
red
  • 117
  • 1
  • 11