Error in getting transaction params using purestack api it shows a 400 status error its on testnet

Hi,
I am getting a issue like this:

{"status":400,"response":{"req":{"method":"GET","url":"https://testnet-algorand.api.purestake.io/idx2/v2/transactions/params","headers":{"x-api-key":"My perfectly correct key","accept":"application/json"}},"header":{"content-type":"application/json","content-length":"108","connection":"close","date":"Tue, 08 Jun 2021 02:58:56 GMT","x-amzn-requestid":"2b3f9683-8efd-427a-970d-f8258dde7c85","x-amz-apigw-id":"Ald1lFSsYosFkvA=","x-amzn-trace-id":"Root=1-60bedcf0-46f5704b122ef65741404d0b","x-cache":"Error from cloudfront","via":"1.1 bec433416691fe0d390ca3e05d3d86a7.cloudfront.net (CloudFront)","x-amz-cf-pop":"DEL54-C4","x-amz-cf-id":"gXeZCpGdYWqyN9Af5tbkrksdYWO8L2pF8vBi7qpBswvcxgh2VljXrg=="},"status":400,"text":"{\"message\":\"invalid input: unable to parse base32 digest data 'txid': illegal base32 data at input byte 0\"}\n"}}

and the code is:

async makeTransaction() {
        try {
            const baseServer = "https://testnet-algorand.api.purestake.io/idx2";
            const port = "";

            const token = {
              "X-API-key": "Again my perfectly correct key",
            };

            const account = "account address";
        
            const algodClient = new algosdk.Algodv2(token, baseServer, port);
            let acc = await algodClient.accountInformation(account).do();
            let params = await algodClient.getTransactionParams().do();
            
            return params;
        } catch (e) {
            return e;
        }
    }

Please somebody help.

Hi!

Some minor changes are needed in your code:
old:
async makeTransaction() {
new:
async function makeTransaction() {

Reason: otherwise you get syntax error

old:
const baseServer = "https://testnet-algorand.api.purestake.io/idx2";
new:
const baseServer = "https://testnet-algorand.api.purestake.io/ps2";

Reason: you specified the index server as the base server

I hope this helps…
Good luck!

1 Like

Thanks so much it helped a lot :slightly_smiling_face:

i tried it but in my case it not working

Hi @zafar,

For the community to be able to help you, please open a new post with:

  1. details about what you want to do and the SDK you’re using
  2. a minimum example that fails (written between triple backquotes ```)
  3. the output you get (again written between triple backquote ```)

You may also consider asking on Discord if you prefer to be able to interact:

Hi @zafar !

The error in the original post was due to using the Indexer URL for the Algod client, a similar issue can be encountered when doing the opposite (ie: using the Algod URL for an Indexer client).

For further help, please share more details about what you’re trying to achieve either here on the forums or on the Discord server Fabrice linked

1 Like

Thanks for reply i resolved this error but now i want to print an nft owner address using javascript sdk how can i do this