in reply to Re: failure: 400
in thread failure: 400

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

Replies are listed 'Best First'.
Re^3: failure: 400
by Corion (Patriarch) on Jan 05, 2019 at 12:46 UTC

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

      even tho i run it in console. same error

      Argument "Key" isn't numeric in subtraction (-) at test.pl line 10. Argument "Apiauth" isn't numeric in subtraction (-) at test.pl line 10 +. Argument "Nonce" isn't numeric in subtraction (-) at test.pl line 10. Argument "Apiauth" isn't numeric in subtraction (-) at test.pl line 10 +. Argument "Signature" isn't numeric in subtraction (-) at test.pl line +10. Argument "Apiauth" isn't numeric in subtraction (-) at test.pl line 10 +. failure: 500 Press any key to continue . . .
        same error

        No, the same error would be "failure: 400" as mentioned in the title. Now you've reported "failure: 500". Different error.

        Argument "Key" isn't numeric in subtraction (-) at test.pl line 10.

        You haven't quoted your key names in the $headers hashref.

      @Corion am running as CGI program coz am building CGI app

      cant run it from console. when its not console program

      i need to see the resluts of wat am buiding

        The idea is to avoid eating the elephant as one bite.

        Try to separate all the steps of your program into small things that are easy to debug in isolation.

        This way, you only have to deal with a single problem at a time, not the many problems that hide the real problems.

Re^3: failure: 400
by marto (Cardinal) on Jan 05, 2019 at 14:56 UTC

    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.