ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

HTTPAPI - http_url_post Response Codes and Headers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • HTTPAPI - http_url_post Response Codes and Headers

    Hi Members,
    We're using HTTPAPI http_url_post to post json data to a server.
    We've been successful in using it (thanks!) but during debug/troubleshoot times, we'd like the ability to determine response codes and http headers.
    Anyone know if there is a way to determine this?

    From the documentation and other notes on this forum, I believe the rc will always provide the response code
    * Returns -1 = error detected internally by HTTPAPI
    * 0 = timeout while receiving data or connecting
    * 1 = file retrieved successfully
    * > 1 = HTTP response code indicating server's error reply
    We are assuming 1 will always be a 200 response code?

    Is there a way for us to read the http headers?

    We understand http_error() also contains some information. What information is exactly concatenated here?

  • #2
    Does http_header() not give you header values?

    Comment


    • #3
      Are you logging? That is always my goto for debug purposes.

      http_debug(*on); // Add second parm for file name if required

      Comment


      • #4
        Are you logging? That is always my goto for debug purposes.

        http_debug(*on); // Add second parm for file name if required

        Comment


        • #5
          Thanks for the tips

          http_header() is useful to retrieve specific headers

          http_debug is very helpful in debugging

          However, what we are looking for is to trap certain response codes and capture all the headers to aid in troubleshooting when problems do occur.

          Comment


          • jtaylor___
            jtaylor___ commented
            Editing a comment
            I've never needed more than what http_error() returns.
        Working...
        X