Closed pierreco closed 3 years ago
Hello,
Since it is a POST request, you should also send a request body.
Here is an example:
async function generateDepositAddress({ walletId, blockchain, network }) {
const defaultClient = Cryptoapis.ApiClient.instance;
const ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = process.env.CRYPTO_API_KEY;
let apiInstance = new Cryptoapis.GeneratingApi();
let item = new Cryptoapis.GenerateDepositAddressRBDataItem('yourLabelStringHere');
let postData = new Cryptoapis.GenerateDepositAddressRBData(item);
let opts = {
'generateDepositAddressRB': new Cryptoapis.GenerateDepositAddressRB(postData)
};
apiInstance.generateDepositAddress(blockchain, network, walletId, opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
return data;
}, (error) => {
console.error(error);
return error?.body?.error?.message
});
}
Kind regards, Crypto APIs
Hello,
When I try to use the v2 API, I get this error.
'{"apiVersion":"2.0.0","requestId":"61249fa7d1d3ceb1da12d030","error":{"code":"invalid_request_body_structure","message":"Your request body for POST requests must have a structure of { data: { item: [...properties] } }"}}'
Here is my code below: