bigup401 has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: failure: 400
by marto (Cardinal) on Jan 05, 2019 at 11:20 UTC

    To start with "Each request also requires a nonce. A nonce is an integer number, that needs to increase with every API request. It's value has to always be greater than the previous request. It is used to ensure identical API requests have different signatures, making impossible for someone to copy your API requests and re-execute them later on."

    You have

    Apiauth-Nonce => 'sdfsdf',

    Which is not an incrementing integer. However based on past experience you're likely not posting what you actually run, and haven't bothered to read or understand the documentation. Queue wasting everyone's time, including your own.

      am sorry to pest bad parameters, bt when i run the code. i expect results like. wrong Apiauth-Key, Apiauth-Nonce or something to show that am connecting to api in right way. ther must be some like unauthorized or wrong authentication to request anything on this api. but i was getting

      error. the page just brings 500 error code. so thats why i had to look for that error by adding the above code to the top of my script and i found out the error was failure: 400

      BEGIN { print "Content-type: text/plain\n\n"; }

      that means am sending bad format of message to api

        As a first step, stop running your programs as CGI programs. Run them from the console.

        Your code, unedited tells you what's wrong:

        marto@Shemp:~/code$ ./rubbish.pl Content-type: text/plain Useless use of a constant ("currency") in void context at ./rubbish.pl + line 25. Useless use of a constant ("USD") in void context at ./rubbish.pl line + 25. Useless use of a constant ("amount") in void context at ./rubbish.pl l +ine 25. Useless use of a constant ("500") in void context at ./rubbish.pl line + 25. Useless use of a constant ("description") in void context at ./rubbish +.pl line 25. Useless use of a constant ("hey") in void context at ./rubbish.pl line + 25. Useless use of a constant ("internal") in void context at ./rubbish.pl + line 25. Argument "Key" isn't numeric in subtraction (-) at ./rubbish.pl line 1 +3. Argument "Apiauth" isn't numeric in subtraction (-) at ./rubbish.pl li +ne 13. Argument "Nonce" isn't numeric in subtraction (-) at ./rubbish.pl line + 13. Argument "Apiauth" isn't numeric in subtraction (-) at ./rubbish.pl li +ne 13. Argument "Signature" isn't numeric in subtraction (-) at ./rubbish.pl +line 13. Argument "Apiauth" isn't numeric in subtraction (-) at ./rubbish.pl li +ne 13. failure: 400

        We've been over the whole CGI development topic before, so I won't waste my time. Run things command line before trying them in the browser, if you are running things as CGI scripts learn how to debug them. Re read the responses to your previous posts, because this has all been explained to you before. Your inconsistent, illogical approach to problems, failure to take advice and not learning from your past experiences/mistakes are the fundamental issues.

Re: failure: 400
by Corion (Patriarch) on Jan 05, 2019 at 11:01 UTC

    What is the actual request sent over the wire?

    Where does HTTP::Tinyish document the content parameter? What format is allowed as value for the content parameter? What data are you sending in the content parameter?