Skip to content

Instantly share code, notes, and snippets.

@Showtimes
Created November 4, 2014 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Showtimes/d5f0807a688071c88ddb to your computer and use it in GitHub Desktop.
Save Showtimes/d5f0807a688071c88ddb to your computer and use it in GitHub Desktop.
Silouet API Documentation 11-4-2014

Generated using rake test with EXTRAINFO=md

Navigation

Api/Balance Histories Controller

Index

description

Get all user's balance histories.
Paginated by default even if params page not specified, per_page default to 25
amountable_type values :
  Transaction
  SpreedlyTransaction
  Withdrawal
amountable.transaction_type values (only for amountable_type = Transaction) :
  by_pin, by_nearby_user, by_email, by_text, undefined
Validations:
  auth_token: required

request (GET)

/api/balance_histories

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken"}

response (200)

{"balance_histories"=>
  [{"amountable"=>
     {"uid"=>"user1transaction1dummyuid",
      "transaction_number"=>111382556,
      "sender"=>
       {"uid"=>"user1dummyuid",
        "name"=>"Dummy User 1.",
        "first_name"=>"Dummy User",
        "last_name"=>"1.",
        "photo"=>
         {"url"=>"http://website.com/assets/default_photo.png",
          "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
        "lat"=>nil,
        "lng"=>nil,
        "sender_privacy"=>"anonymous"},
      "recipient"=>nil,
      "state"=>"pending",
      "transaction_type"=>"by_pin",
      "amount"=>
       {"fractional"=>123.0,
        "currency"=>
         {"id"=>"usd",
          "priority"=>1,
          "iso_code"=>"USD",
          "name"=>"United States Dollar",
          "symbol"=>"$",
          "alternate_symbols"=>["US$"],
          "subunit"=>"Cent",
          "subunit_to_unit"=>100,
          "symbol_first"=>true,
          "html_entity"=>"$",
          "decimal_mark"=>".",
          "thousands_separator"=>",",
          "iso_numeric"=>"840"},
        "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
      "created_at"=>1415024573,
      "lat"=>44.968046,
      "lng"=>-94.420307,
      "initials"=>"AH"},
    "amountable_type"=>"Transaction",
    "amount"=>
     {"fractional"=>-123.0,
      "currency"=>
       {"id"=>"usd",
        "priority"=>1,
        "iso_code"=>"USD",
        "name"=>"United States Dollar",
        "symbol"=>"$",
        "alternate_symbols"=>["US$"],
        "subunit"=>"Cent",
        "subunit_to_unit"=>100,
        "symbol_first"=>true,
        "html_entity"=>"$",
        "decimal_mark"=>".",
        "thousands_separator"=>",",
        "iso_numeric"=>"840"},
      "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
    "notes"=>"Test only",
    "created_at"=>1415024573},
   {"amountable"=>
     {"uid"=>"user1transaction2dummyuid",
      "transaction_number"=>531284392,
      "sender"=>
       {"uid"=>"user1dummyuid",
        "name"=>"Dummy User 1.",
        "first_name"=>"Dummy User",
        "last_name"=>"1.",
        "photo"=>
         {"url"=>"http://website.com/assets/default_photo.png",
          "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
        "lat"=>nil,
        "lng"=>nil,
        "sender_privacy"=>"anonymous"},
      "recipient"=>nil,
      "state"=>"confirmed",
      "transaction_type"=>"by_pin",
      "amount"=>
       {"fractional"=>234.0,
        "currency"=>
         {"id"=>"usd",
          "priority"=>1,
          "iso_code"=>"USD",
          "name"=>"United States Dollar",
          "symbol"=>"$",
          "alternate_symbols"=>["US$"],
          "subunit"=>"Cent",
          "subunit_to_unit"=>100,
          "symbol_first"=>true,
          "html_entity"=>"$",
          "decimal_mark"=>".",
          "thousands_separator"=>",",
          "iso_numeric"=>"840"},
        "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
      "created_at"=>1415024633,
      "lat"=>44.968046,
      "lng"=>-94.420307,
      "initials"=>"AH"},
    "amountable_type"=>"Transaction",
    "amount"=>
     {"fractional"=>-234.0,
      "currency"=>
       {"id"=>"usd",
        "priority"=>1,
        "iso_code"=>"USD",
        "name"=>"United States Dollar",
        "symbol"=>"$",
        "alternate_symbols"=>["US$"],
        "subunit"=>"Cent",
        "subunit_to_unit"=>100,
        "symbol_first"=>true,
        "html_entity"=>"$",
        "decimal_mark"=>".",
        "thousands_separator"=>",",
        "iso_numeric"=>"840"},
      "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
    "notes"=>"Test only",
    "created_at"=>1415024573},
   {"amountable"=>
     {"uid"=>"user1withdrawal1dummyuid",
      "amount"=>
       {"fractional"=>123.0,
        "currency"=>
         {"id"=>"usd",
          "priority"=>1,
          "iso_code"=>"USD",
          "name"=>"United States Dollar",
          "symbol"=>"$",
          "alternate_symbols"=>["US$"],
          "subunit"=>"Cent",
          "subunit_to_unit"=>100,
          "symbol_first"=>true,
          "html_entity"=>"$",
          "decimal_mark"=>".",
          "thousands_separator"=>",",
          "iso_numeric"=>"840"},
        "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
      "last_four_digits"=>nil,
      "card_type"=>nil,
      "state"=>"pending",
      "created_at"=>1415024573},
    "amountable_type"=>"Withdrawal",
    "amount"=>
     {"fractional"=>-123.0,
      "currency"=>
       {"id"=>"usd",
        "priority"=>1,
        "iso_code"=>"USD",
        "name"=>"United States Dollar",
        "symbol"=>"$",
        "alternate_symbols"=>["US$"],
        "subunit"=>"Cent",
        "subunit_to_unit"=>100,
        "symbol_first"=>true,
        "html_entity"=>"$",
        "decimal_mark"=>".",
        "thousands_separator"=>",",
        "iso_numeric"=>"840"},
      "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
    "notes"=>"Test only",
    "created_at"=>1415024573},
   {"amountable"=>
     {"id"=>201079553,
      "user_id"=>206669143,
      "amount_cents"=>123,
      "amount_currency"=>"USD",
      "created_at"=>"2014-11-03T14:22:53.000Z",
      "updated_at"=>"2014-11-03T14:22:53.000Z"},
    "amountable_type"=>"SpreedlyTransaction",
    "amount"=>
     {"fractional"=>-123.0,
      "currency"=>
       {"id"=>"usd",
        "priority"=>1,
        "iso_code"=>"USD",
        "name"=>"United States Dollar",
        "symbol"=>"$",
        "alternate_symbols"=>["US$"],
        "subunit"=>"Cent",
        "subunit_to_unit"=>100,
        "symbol_first"=>true,
        "html_entity"=>"$",
        "decimal_mark"=>".",
        "thousands_separator"=>",",
        "iso_numeric"=>"840"},
      "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
    "notes"=>"Test only",
    "created_at"=>1415024573}]}

Back to top

Api/Home Controller

Feedback

description

Send feedback to support@silouet.com.
Validations:
  auth_token: required
  subject: required
  message: required

request (POST)

/api/feedback

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken",
 "message"=>"Btw newline is OK..\n\nSuch bend, Many viral, Wow!",
 "subject"=>"It's bend!"}

response (200)

Back to top

Feedback Without Subject Failed

request (POST)

/api/feedback

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken",
 "message"=>"no subject? why?",
 "subject"=>""}

response (406)

{"error"=>"Subject and message required."}

Back to top

Api/Invite Codes Controller

Create

description

Request invite code.
Validations:
  auth_token: required

request (POST)

/api/invite_codes

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken"}

response (200)

Back to top

Update

description

Enter invite code.
Validations:
  auth_token: required
  code: required

request (PUT)

/api/invite_codes/update

params

{"auth_token"=>"user3dummyuid.user3dummyauthtoken", "code"=>"ponnies!"}

response (200)

Back to top

Update With Invalid Code

request (PUT)

/api/invite_codes/update

params

{"auth_token"=>"user3dummyuid.user3dummyauthtoken", "code"=>"dragon!"}

response (406)

Back to top

Api/Payment Methods Controller

Create

description

Create new payment method.
Validations:
  auth_token: required
  token: required, unretained payment method token

request (POST)

/api/payment_methods

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken",
 "payment_method"=>{"token"=>"testvalidtoken"}}

response (200)

{"payment_method"=>
  {"uid"=>"fcaa6923-1117-4f07-918c-a85bc8222211",
   "first_name"=>"Perrin",
   "last_four_digits"=>"4444",
   "card_type"=>"master"}}

Back to top

Create With Invalid Token Failed

request (POST)

/api/payment_methods

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken",
 "payment_method"=>{"token"=>"testinvalidtoken"}}

response (422)

{"errors"=>
  {"token"=>
    ["The payment method has been redacted. Therefore, it cannot be retained."]},
 "payment_method"=>
  {"uid"=>nil, "first_name"=>nil, "last_four_digits"=>nil, "card_type"=>nil}}

Back to top

Destroy

description

Delete user's payment method.
Validations:
  auth_token: required
  id: required, payment method uid

request (DELETE)

/api/payment_methods/user1pm2dummyuid

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken"}

response (200)

Back to top

Index

description

Get all user's payment methods.
Validations:
  auth_token: required

request (GET)

/api/payment_methods

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken"}

response (200)

{"payment_methods"=>
  [{"uid"=>"user1pm1dummyuid",
    "first_name"=>"user1first_name",
    "last_four_digits"=>"1111",
    "card_type"=>"visa"},
   {"uid"=>"user1pm2dummyuid",
    "first_name"=>"user1first_name",
    "last_four_digits"=>"1111",
    "card_type"=>"master"}]}

Back to top

Api/Sessions Controller

Login

description

Log user in.
Return auth_token, combine user's uid and auth_token with dot (uid.auth_token) for further request auth_token
Validations:
  user[email]: required
  user[password]: required

request (POST)

/api/sign_in

params

{"user"=>{"email"=>"user1@email.test", "password"=>"testpassword"}}

response (200)

{"user"=>
  {"uid"=>"user1dummyuid",
   "name"=>"Dummy User 1",
   "first_name"=>"Dummy User",
   "last_name"=>"1",
   "phone"=>"123-123-1234-1",
   "email"=>"user1@email.test",
   "unconfirmed_email"=>nil,
   "photo"=>
    {"url"=>"http://website.com/assets/default_photo.png",
     "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
   "pixelated_photo"=>
    {"url"=>"http://website.com/assets/default_photo.png",
     "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
   "phone_confirmed_at"=>nil,
   "pending_phone"=>nil,
   "lat"=>nil,
   "lng"=>nil,
   "is_approved"=>true,
   "balance"=>
    {"fractional"=>0.0,
     "currency"=>
      {"id"=>"usd",
       "priority"=>1,
       "iso_code"=>"USD",
       "name"=>"United States Dollar",
       "symbol"=>"$",
       "alternate_symbols"=>["US$"],
       "subunit"=>"Cent",
       "subunit_to_unit"=>100,
       "symbol_first"=>true,
       "html_entity"=>"$",
       "decimal_mark"=>".",
       "thousands_separator"=>",",
       "iso_numeric"=>"840"},
     "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
   "auth_token"=>"jKHmzfagA1eVuzxDM9hx"}}

Back to top

Login Failure

request (POST)

/api/sign_in

params

{"user"=>{"email"=>"user1@email.test", "password"=>"wrongpassword"}}

response (401)

{"error"=>"Invalid email or password."}

Back to top

Logout

description

Log user out, remove active auth_token.
Will log user out of all devices, don't use this endpoint if you need only 1 device logout.
Validations:
  auth_token: required

request (POST)

/api/sign_out

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken"}

response (200)

Back to top

Private Endpoint Request With Invalid Token Failed

request (POST)

/api/sign_out

params

{"auth_token"=>"user1dummyuid.invalidtoken"}

response (401)

Back to top

Private Endpoint Request Without Token Failed

request (POST)

/api/sign_out

params

{"auth_token"=>"user1dummyuid."}

response (401)

Back to top

Api/Transactions Controller

Create Failed For Not Invited User

request (POST)

/api/transactions

params

{"auth_token"=>"user3dummyuid.user3dummyauthtoken",
 "transaction"=>
  {"amount_cents"=>"1200",
   "initials"=>"AH",
   "lat"=>"44.968046",
   "lng"=>"-94.420307",
   "pin"=>"1234",
   "sender_privacy"=>"anonymous"}}

response (401)

{"error"=>"You need to enter invite code before continuing"}

Back to top

Create Using Pin

description

Create new transaction using PIN and initials.
Validations:
  auth_token: required
  initials: required, max 2 chars
  pin: required, max 10 chars
  lat: required, current latitude of payer
  lng: required, current longitude of payer
  amount_cents: required, greater than 0, transaction amount in cents
  sender_privacy: required, one of anonymous, pixelated, visible

request (POST)

/api/transactions

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken",
 "transaction"=>
  {"amount_cents"=>"1200",
   "initials"=>"AH",
   "lat"=>"44.968046",
   "lng"=>"-94.420307",
   "pin"=>"1234",
   "sender_privacy"=>"anonymous"}}

response (200)

{"transaction"=>
  {"uid"=>"0225ea97-fca1-4c42-8c24-86fdb7aa1714",
   "transaction_number"=>531284393,
   "sender"=>
    {"uid"=>"user1dummyuid",
     "name"=>"Dummy User 1.",
     "first_name"=>"Dummy User",
     "last_name"=>"1.",
     "photo"=>
      {"url"=>"http://website.com/assets/default_photo.png",
       "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
     "lat"=>nil,
     "lng"=>nil,
     "sender_privacy"=>"anonymous"},
   "recipient"=>nil,
   "state"=>"pending",
   "transaction_type"=>"by_pin",
   "amount"=>
    {"fractional"=>1200.0,
     "currency"=>
      {"id"=>"usd",
       "priority"=>1,
       "iso_code"=>"USD",
       "name"=>"United States Dollar",
       "symbol"=>"$",
       "alternate_symbols"=>["US$"],
       "subunit"=>"Cent",
       "subunit_to_unit"=>100,
       "symbol_first"=>true,
       "html_entity"=>"$",
       "decimal_mark"=>".",
       "thousands_separator"=>",",
       "iso_numeric"=>"840"},
     "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
   "is_mine"=>true,
   "created_at"=>1415025176,
   "lat"=>44.968046,
   "lng"=>-94.420307,
   "initials"=>"AH"}}

Back to top

Create Using Email

description

Create new transaction using email.
"recipient_name" is optional and will be used instead of email if specified
Validations:
  auth_token: required
  recipient_email: required
  amount_cents: required, greater than 0, transaction amount in cents
  sender_privacy: required, one of anonymous, pixelated, visible

request (POST)

/api/transactions

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken",
 "transaction"=>
  {"amount_cents"=>"1400",
   "recipient_email"=>"user2@email.test",
   "recipient_name"=>"Dummy User 2",
   "sender_privacy"=>"visible"}}

response (200)

{"transaction"=>
  {"uid"=>"177005a3-0416-4707-b691-2530e3236354",
   "transaction_number"=>531284394,
   "sender"=>
    {"uid"=>"user1dummyuid",
     "name"=>"Dummy User 1.",
     "first_name"=>"Dummy User",
     "last_name"=>"1.",
     "photo"=>
      {"url"=>"http://website.com/assets/default_photo.png",
       "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
     "lat"=>nil,
     "lng"=>nil,
     "sender_privacy"=>"visible"},
   "recipient"=>
    {"email"=>"user2@email.test", "phone"=>nil, "name"=>"Dummy User 2"},
   "state"=>"pending",
   "transaction_type"=>"by_email",
   "amount"=>
    {"fractional"=>1400.0,
     "currency"=>
      {"id"=>"usd",
       "priority"=>1,
       "iso_code"=>"USD",
       "name"=>"United States Dollar",
       "symbol"=>"$",
       "alternate_symbols"=>["US$"],
       "subunit"=>"Cent",
       "subunit_to_unit"=>100,
       "symbol_first"=>true,
       "html_entity"=>"$",
       "decimal_mark"=>".",
       "thousands_separator"=>",",
       "iso_numeric"=>"840"},
     "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
   "is_mine"=>true,
   "created_at"=>1415025176,
   "lat"=>nil,
   "lng"=>nil,
   "initials"=>nil}}

Back to top

Create Using Nearby Users

description

Create new transaction using recipient_uid (from nearby_users).
Validations:
  auth_token: required
  recipient_uid: required
  amount_cents: required, greater than 0, transaction amount in cents
  sender_privacy: required, one of anonymous, pixelated, visible

request (POST)

/api/transactions

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken",
 "transaction"=>
  {"amount_cents"=>"1300",
   "recipient_uid"=>"user2dummyuid",
   "sender_privacy"=>"pixelated"}}

response (200)

{"transaction"=>
  {"uid"=>"1f1727ce-654d-4ab2-b14b-7d76e68f9570",
   "transaction_number"=>531284395,
   "sender"=>
    {"uid"=>"user1dummyuid",
     "name"=>"Dummy User 1.",
     "first_name"=>"Dummy User",
     "last_name"=>"1.",
     "photo"=>
      {"url"=>"http://website.com/assets/default_photo.png",
       "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
     "lat"=>nil,
     "lng"=>nil,
     "sender_privacy"=>"pixelated"},
   "recipient"=>
    {"uid"=>"user2dummyuid",
     "name"=>"Dummy User 2.",
     "first_name"=>"Dummy User",
     "last_name"=>"2.",
     "photo"=>
      {"url"=>"http://website.com/assets/default_photo.png",
       "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
     "lat"=>37.792,
     "lng"=>-122.393,
     "email"=>"user2@email.test",
     "phone"=>"123-123-1234-2"},
   "state"=>"pending",
   "transaction_type"=>"by_nearby_user",
   "amount"=>
    {"fractional"=>1300.0,
     "currency"=>
      {"id"=>"usd",
       "priority"=>1,
       "iso_code"=>"USD",
       "name"=>"United States Dollar",
       "symbol"=>"$",
       "alternate_symbols"=>["US$"],
       "subunit"=>"Cent",
       "subunit_to_unit"=>100,
       "symbol_first"=>true,
       "html_entity"=>"$",
       "decimal_mark"=>".",
       "thousands_separator"=>",",
       "iso_numeric"=>"840"},
     "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
   "is_mine"=>true,
   "created_at"=>1415025176,
   "lat"=>nil,
   "lng"=>nil,
   "initials"=>nil}}

Back to top

Create Using Phone

description

Create new transaction using phone.
"recipient_name" is optional and will be used instead of phone if specified
Validations:
  auth_token: required
  recipient_phone: required
  amount_cents: required, greater than 0, transaction amount in cents
  sender_privacy: required, one of anonymous, pixelated, visible

request (POST)

/api/transactions

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken",
 "transaction"=>
  {"amount_cents"=>"1450",
   "recipient_phone"=>"123-123-1234-2",
   "sender_privacy"=>"visible"}}

response (200)

{"transaction"=>
  {"uid"=>"95951a6c-83b8-4d74-bd9d-31c4fb650b1a",
   "transaction_number"=>531284396,
   "sender"=>
    {"uid"=>"user1dummyuid",
     "name"=>"Dummy User 1.",
     "first_name"=>"Dummy User",
     "last_name"=>"1.",
     "photo"=>
      {"url"=>"http://website.com/assets/default_photo.png",
       "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
     "lat"=>nil,
     "lng"=>nil,
     "sender_privacy"=>"visible"},
   "recipient"=>{"email"=>nil, "phone"=>"123-123-1234-2", "name"=>nil},
   "state"=>"pending",
   "transaction_type"=>"by_text",
   "amount"=>
    {"fractional"=>1450.0,
     "currency"=>
      {"id"=>"usd",
       "priority"=>1,
       "iso_code"=>"USD",
       "name"=>"United States Dollar",
       "symbol"=>"$",
       "alternate_symbols"=>["US$"],
       "subunit"=>"Cent",
       "subunit_to_unit"=>100,
       "symbol_first"=>true,
       "html_entity"=>"$",
       "decimal_mark"=>".",
       "thousands_separator"=>",",
       "iso_numeric"=>"840"},
     "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
   "is_mine"=>true,
   "created_at"=>1415025176,
   "lat"=>nil,
   "lng"=>nil,
   "initials"=>nil}}

Back to top

Index

description

Get all user's transactions.
Validations:
  auth_token: required

request (GET)

/api/transactions

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken"}

response (200)

{"transactions"=>
  [{"uid"=>"user1transaction2dummyuid",
    "transaction_number"=>531284392,
    "sender"=>
     {"uid"=>"user1dummyuid",
      "name"=>"Dummy User 1.",
      "first_name"=>"Dummy User",
      "last_name"=>"1.",
      "photo"=>
       {"url"=>"http://website.com/assets/default_photo.png",
        "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
      "lat"=>nil,
      "lng"=>nil,
      "sender_privacy"=>"anonymous"},
    "recipient"=>nil,
    "state"=>"confirmed",
    "transaction_type"=>"by_pin",
    "amount"=>
     {"fractional"=>234.0,
      "currency"=>
       {"id"=>"usd",
        "priority"=>1,
        "iso_code"=>"USD",
        "name"=>"United States Dollar",
        "symbol"=>"$",
        "alternate_symbols"=>["US$"],
        "subunit"=>"Cent",
        "subunit_to_unit"=>100,
        "symbol_first"=>true,
        "html_entity"=>"$",
        "decimal_mark"=>".",
        "thousands_separator"=>",",
        "iso_numeric"=>"840"},
      "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
    "is_mine"=>true,
    "created_at"=>1415024633,
    "lat"=>44.968046,
    "lng"=>-94.420307,
    "initials"=>"AH"},
   {"uid"=>"user1transaction1dummyuid",
    "transaction_number"=>111382556,
    "sender"=>
     {"uid"=>"user1dummyuid",
      "name"=>"Dummy User 1.",
      "first_name"=>"Dummy User",
      "last_name"=>"1.",
      "photo"=>
       {"url"=>"http://website.com/assets/default_photo.png",
        "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
      "lat"=>nil,
      "lng"=>nil,
      "sender_privacy"=>"anonymous"},
    "recipient"=>nil,
    "state"=>"pending",
    "transaction_type"=>"by_pin",
    "amount"=>
     {"fractional"=>123.0,
      "currency"=>
       {"id"=>"usd",
        "priority"=>1,
        "iso_code"=>"USD",
        "name"=>"United States Dollar",
        "symbol"=>"$",
        "alternate_symbols"=>["US$"],
        "subunit"=>"Cent",
        "subunit_to_unit"=>100,
        "symbol_first"=>true,
        "html_entity"=>"$",
        "decimal_mark"=>".",
        "thousands_separator"=>",",
        "iso_numeric"=>"840"},
      "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
    "is_mine"=>true,
    "created_at"=>1415024573,
    "lat"=>44.968046,
    "lng"=>-94.420307,
    "initials"=>"AH"}]}

Back to top

Index Paginated

description

Get all user's transactions paginated.
Parameters:
  page: integer, page number start from 1
  per_page: number of items in 1 page, default to 25 if unspecified

request (GET)

/api/transactions

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken",
 "page"=>"2",
 "per_page"=>"1"}

response (200)

{"transactions"=>
  [{"uid"=>"user1transaction1dummyuid",
    "transaction_number"=>111382556,
    "sender"=>
     {"uid"=>"user1dummyuid",
      "name"=>"Dummy User 1.",
      "first_name"=>"Dummy User",
      "last_name"=>"1.",
      "photo"=>
       {"url"=>"http://website.com/assets/default_photo.png",
        "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
      "lat"=>nil,
      "lng"=>nil,
      "sender_privacy"=>"anonymous"},
    "recipient"=>nil,
    "state"=>"pending",
    "transaction_type"=>"by_pin",
    "amount"=>
     {"fractional"=>123.0,
      "currency"=>
       {"id"=>"usd",
        "priority"=>1,
        "iso_code"=>"USD",
        "name"=>"United States Dollar",
        "symbol"=>"$",
        "alternate_symbols"=>["US$"],
        "subunit"=>"Cent",
        "subunit_to_unit"=>100,
        "symbol_first"=>true,
        "html_entity"=>"$",
        "decimal_mark"=>".",
        "thousands_separator"=>",",
        "iso_numeric"=>"840"},
      "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
    "is_mine"=>true,
    "created_at"=>1415024573,
    "lat"=>44.968046,
    "lng"=>-94.420307,
    "initials"=>"AH"}]}

Back to top

Show When Locked

request (GET)

/api/transactions/find

params

{"auth_token"=>"user2dummyuid.user2dummyauthtoken",
 "lat"=>"44.968046",
 "lng"=>"-94.420307",
 "pin"=>"1234"}

response (422)

{"error"=>"You're locked for about 1 hour. Contact support for help.",
 "locked_at"=>1415025176}

Back to top

Show With Pin And Location

description

Find transaction using PIN and location within 100 meters.
Validations:
  auth_token: required
  pin: required, max 10 chars
  lat: required, latitude of payer
  lng: required, longitude of payer
Responses:
  200: transaction found, proceed to update to accept
  404: transaction not found, wrong pin and lat, lng combination
  422: user locked, wait until locked_at time to retry

request (GET)

/api/transactions/find

params

{"auth_token"=>"user2dummyuid.user2dummyauthtoken",
 "lat"=>"44.968046",
 "lng"=>"-94.420307",
 "pin"=>"1234"}

response (200)

{"transaction"=>
  {"transaction_number"=>111382556,
   "sender"=>
    {"uid"=>"user1dummyuid",
     "name"=>"Dummy User 1.",
     "first_name"=>"Dummy User",
     "last_name"=>"1.",
     "photo"=>
      {"url"=>"http://website.com/assets/default_photo.png",
       "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
     "lat"=>nil,
     "lng"=>nil,
     "sender_privacy"=>"anonymous"},
   "recipient"=>
    {"uid"=>"user2dummyuid",
     "name"=>"Dummy User 2.",
     "first_name"=>"Dummy User",
     "last_name"=>"2.",
     "photo"=>
      {"url"=>"http://website.com/assets/default_photo.png",
       "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
     "lat"=>37.792,
     "lng"=>-122.393,
     "email"=>"user2@email.test",
     "phone"=>"123-123-1234-2"},
   "amount"=>
    {"fractional"=>123.0,
     "currency"=>
      {"id"=>"usd",
       "priority"=>1,
       "iso_code"=>"USD",
       "name"=>"United States Dollar",
       "symbol"=>"$",
       "alternate_symbols"=>["US$"],
       "subunit"=>"Cent",
       "subunit_to_unit"=>100,
       "symbol_first"=>true,
       "html_entity"=>"$",
       "decimal_mark"=>".",
       "thousands_separator"=>",",
       "iso_numeric"=>"840"},
     "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
   "is_mine"=>false}}

Back to top

Show With Wrong Pin Locked

request (GET)

/api/transactions/find

params

{"auth_token"=>"user2dummyuid.user2dummyauthtoken",
 "lat"=>"44.968046",
 "lng"=>"-94.420307",
 "pin"=>"wrong"}

response (404)

{"error"=>"You're now locked for 1 hours. Contact support for help.",
 "attempts"=>3,
 "max_attempts"=>3}

Back to top

Show With Wrong Location

request (GET)

/api/transactions/find

params

{"auth_token"=>"user2dummyuid.user2dummyauthtoken",
 "lat"=>"54.968046",
 "lng"=>"-94.420307",
 "pin"=>"1234"}

response (404)

{"error"=>
  "Oops, the PIN or location doesn't match payments. Check your PIN code and location or get help from our support team.",
 "attempts"=>1,
 "max_attempts"=>3}

Back to top

Show With Wrong Location Last Chance

request (GET)

/api/transactions/find

params

{"auth_token"=>"user2dummyuid.user2dummyauthtoken",
 "lat"=>"54.968046",
 "lng"=>"-94.420307",
 "pin"=>"1234"}

response (404)

{"error"=>
  "You will get locked out for 1 hours after another failed attempt so please contact support if you need help.",
 "attempts"=>2,
 "max_attempts"=>3}

Back to top

Update With Pin, Location And Initials

description

Confirm a transaction using PIN, location and initials.
Validations:
  auth_token: required
  initials: required, max 2 chars
  pin: required, max 10 chars
  lat: required, current latitude of payer
  lng: required, current longitude of payer

request (PATCH)

/api/transactions/find

params

{"auth_token"=>"user2dummyuid.user2dummyauthtoken",
 "initials"=>"AH",
 "lat"=>"44.968046",
 "lng"=>"-94.420307",
 "pin"=>"1234"}

response (200)

{"transaction"=>
  {"uid"=>"user1transaction1dummyuid",
   "transaction_number"=>111382556,
   "sender"=>
    {"uid"=>"user1dummyuid",
     "name"=>"Dummy User 1.",
     "first_name"=>"Dummy User",
     "last_name"=>"1.",
     "photo"=>
      {"url"=>"http://website.com/assets/default_photo.png",
       "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
     "lat"=>nil,
     "lng"=>nil,
     "sender_privacy"=>"anonymous"},
   "recipient"=>
    {"uid"=>"user2dummyuid",
     "name"=>"Dummy User 2.",
     "first_name"=>"Dummy User",
     "last_name"=>"2.",
     "photo"=>
      {"url"=>"http://website.com/assets/default_photo.png",
       "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
     "lat"=>37.792,
     "lng"=>-122.393,
     "email"=>"user2@email.test",
     "phone"=>"123-123-1234-2"},
   "state"=>"confirmed",
   "transaction_type"=>"by_pin",
   "amount"=>
    {"fractional"=>123.0,
     "currency"=>
      {"id"=>"usd",
       "priority"=>1,
       "iso_code"=>"USD",
       "name"=>"United States Dollar",
       "symbol"=>"$",
       "alternate_symbols"=>["US$"],
       "subunit"=>"Cent",
       "subunit_to_unit"=>100,
       "symbol_first"=>true,
       "html_entity"=>"$",
       "decimal_mark"=>".",
       "thousands_separator"=>",",
       "iso_numeric"=>"840"},
     "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
   "is_mine"=>false,
   "created_at"=>1415024573,
   "lat"=>44.968046,
   "lng"=>-94.420307,
   "initials"=>"AH"}}

Back to top

Update With Invalid Initials

request (PATCH)

/api/transactions/find

params

{"auth_token"=>"user2dummyuid.user2dummyauthtoken",
 "initials"=>"HA",
 "lat"=>"44.968046",
 "lng"=>"-94.420307",
 "pin"=>"1234"}

response (406)

{"error"=>"Invalid initials."}

Back to top

Update With Spreedly Failure

request (PATCH)

/api/transactions/find

params

{"auth_token"=>"user2dummyuid.user2dummyauthtoken",
 "initials"=>"AH",
 "lat"=>"44.968046",
 "lng"=>"-94.420307",
 "pin"=>"1234"}

response (422)

{"error"=>"Validation failed: Unable to process the purchase transaction."}

Back to top

Api/Users Controller

Create

description

Sign-up user.
Validations:
  email: required, unique
  password: required, min 8 chars, equal to "password_confirmation" if supplied
  phone_confirmation_uid: required, from "verify_phone_number" endpoint

request (POST)

/api/sign_up

params

{"user"=>
  {"email"=>"valid@email.test",
   "first_name"=>"Aya",
   "last_name"=>"Hirano",
   "password"=>"8chars!!",
   "phone_confirmation_uid"=>"phone_confirmation-confirmed_uid",
   "photo"=>"#<ActionDispatch::Http::UploadedFile:0x007fe8431b1470>",
   "pixelated_photo"=>
    "#<ActionDispatch::Http::UploadedFile:0x007fe8431b9788>"}}

response (200)

{"user"=>
  {"uid"=>"cf084fed-8296-45a9-ad8c-e8c09c77c4ac",
   "name"=>"Aya Hirano",
   "first_name"=>"Aya",
   "last_name"=>"Hirano",
   "phone"=>"12345678",
   "email"=>"valid@email.test",
   "unconfirmed_email"=>nil,
   "photo"=>
    {"url"=>"/uploads/user/photo/1010528734/1.jpg",
     "thumb"=>{"url"=>"/uploads/user/photo/1010528734/thumb_1.jpg"}},
   "pixelated_photo"=>
    {"url"=>"/uploads/user/pixelated_photo/1010528734/2.jpg",
     "thumb"=>{"url"=>"/uploads/user/pixelated_photo/1010528734/thumb_2.jpg"}},
   "phone_confirmed_at"=>nil,
   "pending_phone"=>nil,
   "lat"=>nil,
   "lng"=>nil,
   "is_approved"=>false,
   "balance"=>
    {"fractional"=>0.0,
     "currency"=>
      {"id"=>"usd",
       "priority"=>1,
       "iso_code"=>"USD",
       "name"=>"United States Dollar",
       "symbol"=>"$",
       "alternate_symbols"=>["US$"],
       "subunit"=>"Cent",
       "subunit_to_unit"=>100,
       "symbol_first"=>true,
       "html_entity"=>"$",
       "decimal_mark"=>".",
       "thousands_separator"=>",",
       "iso_numeric"=>"840"},
     "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
   "auth_token"=>nil}}

Back to top

Create With Preapproved Email

description

Sign-up user with preapproved email domain (for example findandform.com).

request (POST)

/api/sign_up

params

{"user"=>
  {"email"=>"mr.bubbla@findandform.com",
   "first_name"=>"Mr",
   "last_name"=>"Bubbla",
   "password"=>"8chars!!",
   "phone_confirmation_uid"=>"phone_confirmation-confirmed_uid"}}

response (200)

{"user"=>
  {"uid"=>"d4011408-5767-45b5-9fac-c18ee079a0ee",
   "name"=>"Mr Bubbla",
   "first_name"=>"Mr",
   "last_name"=>"Bubbla",
   "phone"=>"12345678",
   "email"=>"mr.bubbla@findandform.com",
   "unconfirmed_email"=>nil,
   "photo"=>
    {"url"=>"http://website.com/assets/default_photo.png",
     "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
   "pixelated_photo"=>
    {"url"=>"http://website.com/assets/default_photo.png",
     "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
   "phone_confirmed_at"=>nil,
   "pending_phone"=>nil,
   "lat"=>nil,
   "lng"=>nil,
   "is_approved"=>true,
   "balance"=>
    {"fractional"=>0.0,
     "currency"=>
      {"id"=>"usd",
       "priority"=>1,
       "iso_code"=>"USD",
       "name"=>"United States Dollar",
       "symbol"=>"$",
       "alternate_symbols"=>["US$"],
       "subunit"=>"Cent",
       "subunit_to_unit"=>100,
       "symbol_first"=>true,
       "html_entity"=>"$",
       "decimal_mark"=>".",
       "thousands_separator"=>",",
       "iso_numeric"=>"840"},
     "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
   "auth_token"=>nil}}

Back to top

Create With Short Password Failed

request (POST)

/api/sign_up

params

{"user"=>
  {"email"=>"valid@email.test",
   "name"=>"Aya Hirano",
   "password"=>"no8char",
   "phone_confirmation_uid"=>"phone_confirmation-confirmed_uid"}}

response (422)

{"errors"=>{"password"=>["is too short (minimum is 8 characters)"]},
 "user"=>
  {"uid"=>nil,
   "name"=>"Aya Hirano",
   "first_name"=>"Aya",
   "last_name"=>"Hirano",
   "phone"=>"12345678",
   "email"=>"valid@email.test",
   "unconfirmed_email"=>nil,
   "photo"=>
    {"url"=>"http://website.com/assets/default_photo.png",
     "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
   "pixelated_photo"=>
    {"url"=>"http://website.com/assets/default_photo.png",
     "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
   "phone_confirmed_at"=>nil,
   "pending_phone"=>nil,
   "lat"=>nil,
   "lng"=>nil,
   "is_approved"=>false,
   "balance"=>
    {"fractional"=>0.0,
     "currency"=>
      {"id"=>"usd",
       "priority"=>1,
       "iso_code"=>"USD",
       "name"=>"United States Dollar",
       "symbol"=>"$",
       "alternate_symbols"=>["US$"],
       "subunit"=>"Cent",
       "subunit_to_unit"=>100,
       "symbol_first"=>true,
       "html_entity"=>"$",
       "decimal_mark"=>".",
       "thousands_separator"=>",",
       "iso_numeric"=>"840"},
     "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
   "auth_token"=>nil}}

Back to top

Create Without Phone Failed

request (POST)

/api/sign_up

params

{"user"=>
  {"email"=>"valid@email.test", "name"=>"Aya Hirano", "password"=>"8chars!!"}}

response (422)

{"errors"=>{"phone"=>["can't be blank"]},
 "user"=>
  {"uid"=>nil,
   "name"=>"Aya Hirano",
   "first_name"=>"Aya",
   "last_name"=>"Hirano",
   "phone"=>nil,
   "email"=>"valid@email.test",
   "unconfirmed_email"=>nil,
   "photo"=>
    {"url"=>"http://website.com/assets/default_photo.png",
     "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
   "pixelated_photo"=>
    {"url"=>"http://website.com/assets/default_photo.png",
     "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
   "phone_confirmed_at"=>nil,
   "pending_phone"=>nil,
   "lat"=>nil,
   "lng"=>nil,
   "is_approved"=>false,
   "balance"=>
    {"fractional"=>0.0,
     "currency"=>
      {"id"=>"usd",
       "priority"=>1,
       "iso_code"=>"USD",
       "name"=>"United States Dollar",
       "symbol"=>"$",
       "alternate_symbols"=>["US$"],
       "subunit"=>"Cent",
       "subunit_to_unit"=>100,
       "symbol_first"=>true,
       "html_entity"=>"$",
       "decimal_mark"=>".",
       "thousands_separator"=>",",
       "iso_numeric"=>"840"},
     "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
   "auth_token"=>nil}}

Back to top

Forgot Password

description

Request password reset for user.
Send instruction email if user with the email existed, ignore invalid email.

request (POST)

/api/forgot_password

params

{"user"=>{"email"=>"user1@email.test"}}

response (200)

Back to top

Forgot Password With Non Existant Email Failed

description

Request password reset for user.
This is a sample for non-existant email, no error returned to partially prevent user enumeration.
https://www.owasp.org/index.php/Testing_for_user_enumeration_(OWASP-AT-002)

request (POST)

/api/forgot_password

params

{"user"=>{"email"=>"non_existant@email.test"}}

response (200)

Back to top

Nearby Users

description

Get nearby users in default 1000 meters radius.
Validations:
  auth_token: required

request (GET)

/api/nearby_users

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken"}

response (200)

{"nearby_users"=>
  [{"uid"=>"user2dummyuid",
    "name"=>"Dummy User 2.",
    "first_name"=>"Dummy User",
    "last_name"=>"2.",
    "photo"=>
     {"url"=>"http://website.com/assets/default_photo.png",
      "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
    "lat"=>37.792,
    "lng"=>-122.393}]}

Back to top

Nearby Users With Large Radius

request (GET)

/api/nearby_users

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken", "radius"=>"100000"}

response (200)

{"nearby_users"=>
  [{"uid"=>"user2dummyuid",
    "name"=>"Dummy User 2.",
    "first_name"=>"Dummy User",
    "last_name"=>"2.",
    "photo"=>
     {"url"=>"http://website.com/assets/default_photo.png",
      "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
    "lat"=>37.792,
    "lng"=>-122.393},
   {"uid"=>"user3dummyuid",
    "name"=>"Dummy User 3.",
    "first_name"=>"Dummy User",
    "last_name"=>"3.",
    "photo"=>
     {"url"=>"http://website.com/assets/default_photo.png",
      "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
    "lat"=>44.968046,
    "lng"=>-94.420307},
   {"uid"=>"user4dummyuid",
    "name"=>"Dummy User 4.",
    "first_name"=>"Dummy User",
    "last_name"=>"4.",
    "photo"=>
     {"url"=>"http://website.com/assets/default_photo.png",
      "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
    "lat"=>32.91663,
    "lng"=>-96.982841}]}

Back to top

Nearby Users With Small Radius

description

Get nearby users in specified radius (in meters).
Validations:
  auth_token: required

request (GET)

/api/nearby_users

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken", "radius"=>"0.1"}

response (200)

{"nearby_users"=>[]}

Back to top

Send Email Confirmation

description

Send / re-send email confirmation.
Behave the same as forgot password that it will always return 200 even if the email don't exists / already confirmed.

request (POST)

/api/send_email_confirmation

params

{"user"=>{"email"=>"user4@email.test"}}

response (200)

Back to top

Show

description

Get user attributes.
Validations:
  auth_token: required

request (GET)

/api/profile

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken"}

response (200)

{"user"=>
  {"uid"=>"user1dummyuid",
   "name"=>"Dummy User 1",
   "first_name"=>"Dummy User",
   "last_name"=>"1",
   "phone"=>"123-123-1234-1",
   "email"=>"user1@email.test",
   "unconfirmed_email"=>nil,
   "photo"=>
    {"url"=>"http://website.com/assets/default_photo.png",
     "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
   "pixelated_photo"=>
    {"url"=>"http://website.com/assets/default_photo.png",
     "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
   "phone_confirmed_at"=>nil,
   "pending_phone"=>nil,
   "lat"=>nil,
   "lng"=>nil,
   "is_approved"=>true,
   "balance"=>
    {"fractional"=>0.0,
     "currency"=>
      {"id"=>"usd",
       "priority"=>1,
       "iso_code"=>"USD",
       "name"=>"United States Dollar",
       "symbol"=>"$",
       "alternate_symbols"=>["US$"],
       "subunit"=>"Cent",
       "subunit_to_unit"=>100,
       "symbol_first"=>true,
       "html_entity"=>"$",
       "decimal_mark"=>".",
       "thousands_separator"=>",",
       "iso_numeric"=>"840"},
     "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}}}}

Back to top

Update Password

description

Update user password.
Validations:
  auth_token: required
  user[current_password]: required

request (PUT)

/api/profile

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken",
 "user"=>{"current_password"=>"testpassword", "password"=>"validnewpassword"}}

response (200)

{"user"=>
  {"uid"=>"user1dummyuid",
   "name"=>"Dummy User 1",
   "first_name"=>"Dummy User",
   "last_name"=>"1",
   "phone"=>"123-123-1234-1",
   "email"=>"user1@email.test",
   "unconfirmed_email"=>nil,
   "photo"=>
    {"url"=>"http://website.com/assets/default_photo.png",
     "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
   "pixelated_photo"=>
    {"url"=>"http://website.com/assets/default_photo.png",
     "thumb"=>{"url"=>"http://website.com/assets/default_photo.png"}},
   "phone_confirmed_at"=>nil,
   "pending_phone"=>nil,
   "lat"=>nil,
   "lng"=>nil,
   "is_approved"=>true,
   "balance"=>
    {"fractional"=>0.0,
     "currency"=>
      {"id"=>"usd",
       "priority"=>1,
       "iso_code"=>"USD",
       "name"=>"United States Dollar",
       "symbol"=>"$",
       "alternate_symbols"=>["US$"],
       "subunit"=>"Cent",
       "subunit_to_unit"=>100,
       "symbol_first"=>true,
       "html_entity"=>"$",
       "decimal_mark"=>".",
       "thousands_separator"=>",",
       "iso_numeric"=>"840"},
     "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}}}}

Back to top

Update Password With Invalid Current Password Failed

request (PUT)

/api/profile

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken",
 "user"=>{"current_password"=>"wrongpassword", "password"=>"validnewpassword"}}

response (406)

{"errors"=>{"current_password"=>["is invalid"]}}

Back to top

Update Phone To Existing Number Failed

request (PUT)

/api/profile

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken",
 "user"=>{"phone"=>"123-123-1234-2"}}

response (406)

{"errors"=>{"number"=>["has already been taken"]}}

Back to top

Update Without Change In Password

description

Update user attributes except for password.
Phone update won't take effect immediately and until confirmed using token from sms see "verify_phone_number" endpoint.
Validations:
  auth_token: required

request (PUT)

/api/profile

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken",
 "user"=>
  {"email"=>"valid@email.test",
   "lat"=>"37.792",
   "lng"=>"-94.420307",
   "name"=>"Aya Hirano",
   "phone"=>"12345678",
   "photo"=>"#<ActionDispatch::Http::UploadedFile:0x007fe8426904d8>",
   "pixelated_photo"=>
    "#<ActionDispatch::Http::UploadedFile:0x007fe842694e48>"}}

response (200)

{"user"=>
  {"uid"=>"user1dummyuid",
   "name"=>"Aya Hirano",
   "first_name"=>"Aya",
   "last_name"=>"Hirano",
   "phone"=>"123-123-1234-1",
   "email"=>"user1@email.test",
   "unconfirmed_email"=>"valid@email.test",
   "photo"=>
    {"url"=>"/uploads/user/photo/206669143/2.jpg",
     "thumb"=>{"url"=>"/uploads/user/photo/206669143/thumb_2.jpg"}},
   "pixelated_photo"=>
    {"url"=>"/uploads/user/pixelated_photo/206669143/1.jpg",
     "thumb"=>{"url"=>"/uploads/user/pixelated_photo/206669143/thumb_1.jpg"}},
   "phone_confirmed_at"=>nil,
   "pending_phone"=>"12345678",
   "lat"=>37.792,
   "lng"=>-94.420307,
   "is_approved"=>true,
   "balance"=>
    {"fractional"=>0.0,
     "currency"=>
      {"id"=>"usd",
       "priority"=>1,
       "iso_code"=>"USD",
       "name"=>"United States Dollar",
       "symbol"=>"$",
       "alternate_symbols"=>["US$"],
       "subunit"=>"Cent",
       "subunit_to_unit"=>100,
       "symbol_first"=>true,
       "html_entity"=>"$",
       "decimal_mark"=>".",
       "thousands_separator"=>",",
       "iso_numeric"=>"840"},
     "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}}}}

Back to top

Verify Phone Number Confirm

description

Confirm phone number with token received from sms for non-logged-in user.
Validations:
  id: required, "phone_confirmation_uid", can be omitted if "../verify_phone_number/[phone_confirmation_uid]" used
  token: required

request (PUT)

/api/verify_phone_number

params

{"id"=>"phone_confirmation-sent_uid", "token"=>"phone_confirmation-sent_token"}

response (200)

Back to top

Verify Phone Number Confirm Later Than 30 Minutes Failed

request (PUT)

/api/verify_phone_number

params

{"id"=>"phone_confirmation-sent_uid", "token"=>"phone_confirmation-sent_token"}

response (406)

Back to top

Verify Phone Number For Logged In User

description

Confirm phone number with token received from sms for logged-in user.
Validations:
  auth_token: required
  token: required

request (PUT)

/api/verify_phone_number

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken", "token"=>"B64EC0"}

response (200)

Back to top

Verify Phone Number Request

description

Request phone number confirmation, send sms with token if phone number valid.
Return "phone_confirmation_uid" to be used for confirming the number
Validations:
  phone: required

request (POST)

/api/verify_phone_number

params

{"phone"=>"+15558675309"}

response (200)

{"phone_confirmation_uid"=>"af9b518f-e0e1-4b82-be4e-9c16a9fb773e"}

Back to top

Verify Phone Number Request For Existing Number Failed

request (POST)

/api/verify_phone_number

params

{"phone"=>"123-123-1234-2"}

response (200)

Back to top

Verify Phone Number With Invalid Uid Failed

request (PUT)

/api/verify_phone_number

params

{"id"=>"thatwatmoment", "token"=>"phone_confirmation-sent_token"}

response (200)

Back to top

Api/Withdrawals Controller

Create

description

Create new withdrawal
Validations:
  auth_token: required
  payment_method_uid: required
  amount_cents: required, greater than 100

request (POST)

/api/withdrawals

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken",
 "withdrawal"=>
  {"amount_cents"=>"100", "payment_method_uid"=>"user1pm2dummyuid"}}

response (200)

{"withdrawal"=>
  {"uid"=>"00d35dc5-e27c-4831-bd4a-50e8b4dfde06",
   "amount"=>
    {"fractional"=>100.0,
     "currency"=>
      {"id"=>"usd",
       "priority"=>1,
       "iso_code"=>"USD",
       "name"=>"United States Dollar",
       "symbol"=>"$",
       "alternate_symbols"=>["US$"],
       "subunit"=>"Cent",
       "subunit_to_unit"=>100,
       "symbol_first"=>true,
       "html_entity"=>"$",
       "decimal_mark"=>".",
       "thousands_separator"=>",",
       "iso_numeric"=>"840"},
     "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
   "last_four_digits"=>"1111",
   "card_type"=>"master",
   "state"=>"pending",
   "created_at"=>1415025174}}

Back to top

Create Failed With Insufficient Balance

request (POST)

/api/withdrawals

params

{"auth_token"=>"user1dummyuid.user1dummyauthtoken",
 "withdrawal"=>
  {"amount_cents"=>"100", "payment_method_uid"=>"user1pm2dummyuid"}}

response (422)

{"errors"=>{"amount_cents"=>["must be less than or equal to 99"]},
 "withdrawal"=>
  {"uid"=>nil,
   "amount"=>
    {"fractional"=>100.0,
     "currency"=>
      {"id"=>"usd",
       "priority"=>1,
       "iso_code"=>"USD",
       "name"=>"United States Dollar",
       "symbol"=>"$",
       "alternate_symbols"=>["US$"],
       "subunit"=>"Cent",
       "subunit_to_unit"=>100,
       "symbol_first"=>true,
       "html_entity"=>"$",
       "decimal_mark"=>".",
       "thousands_separator"=>",",
       "iso_numeric"=>"840"},
     "bank"=>{"rounding_method"=>nil, "rates"=>{}, "mutex"=>{}}},
   "last_four_digits"=>"1111",
   "card_type"=>"master",
   "state"=>"pending",
   "created_at"=>nil}}

Back to top

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment