Skip to content

Add Check

Request URL

POST /cheques/sync

Description

This API receives an array of new checks as input and updates the existing list. It compares these checks with the existing records and removes duplicates. Large images are also removed.

Schema

Array table for cheques/sync

Array containing Description Required Schema
cheques/sync items cheques/sync items Array of cheques/sync objects

Property table for cheques/sync object

Property Description Required Schema
amount Amount Yes {
  "type": "number"
}
currency 3-letter ISO alphabetic code to identify the currency Yes {
  "type": "string",
  "pattern": "^[A-Z]{3}$"
}
isDeleted true if deleted No {
  "type": "boolean",
  "nullable": true,
  "default": false
}
imgFrontB64 imgFrontB64 No {
  "type": "string",
  "nullable": true
}
imgBackB64 imgBackB64 No {
  "type": "string",
  "nullable": true
}
thumbFrontB64 thumbFrontB64 No {
  "type": "string",
  "nullable": true
}
thumbBackB64 thumbBackB64 No {
  "type": "string",
  "nullable": true
}

Request Body

[ 
    {
        "amount": 1.01,
        "currency": "USD"
    }
]

Snippet Examples

javascript

const axios = require('axios');
const data = [ 
    {
        "amount": 1.01,
        "currency": "USD"
    }
];
const config = {
  method: 'POST',
  url: '${AMPLIFI_BASE_URL}/cheques/sync',
  headers: {
    'Content-Type': "application/json",
    'token': "A long random string token received from /token request"
  },
  data
};

let result;
try {
  result = await axios.request(config);
  if (result.status === 200) {
    console.log(JSON.stringify(result.data));
  }
} catch (err) {
  console.log({
    errCode: err.code,
    responseStatus: err.response && err.response.status,
    data: err.response && JSON.stringify(err.response.data)
  });
}

cURL

curl --location "AMPLIFI_BASE_URL/cheques/sync" --data "[     {        \"amount\":1.01,       \"currency\":\"USD\"    }]" --header "Content-Type: application/json" --header "token: A long random string token received from /token request" 

Successful Response Examples

200 CHEQUES/SYNC SUCCESSFUL RESPONSE

HEADERS

Header Value
Content-Type application/json
token A long random string token received from /token request

REQUEST BODY

[ 
    {
        "amount": 1.01,
        "currency": "USD"
    }
]

RESPONSE BODY

{
    "success": true,
    "cheques": [
        {
            "_id": "657b43a418e95734fbef1083",
            "AFiChequeId": "qweawcqlq5if7bzdhkpkhyvopbtzbjnqvmvmokpuxtyacij",
            "AFiUserId": "qweaurl8kgtlv9pc",
            "amount": 1.01,
            "currency": "USD",
            "dtsCreated": "2023-12-14T18:04:20.063Z",
            "dtsModified": "2023-12-14T18:04:20.063Z",
            "isAccepted": false,
            "isActive": true,
            "isCredited": false,
            "isDeleted": false,
            "isPendingApproval": false
        }
    ]
}