Generate Chilkat Code from PostMan

This is a way to generate Chilkat source code from a working PostMan request:

    1. Open Postman: Launch the Postman application on your computer.
    2. Create or Import a Request: Create a new request or import an existing one that you want to inspect the raw HTTP request for.
    3. Send the Request: Click the “Send” button to send the request to the server.
    4. After sending the request, view the raw HTTP request by switching to the “Console” tab at the bottom of the user interface.  For example:
    5. Click on the blue “Show raw log”  located on the right side of the console.  You will now see the raw log, like this: 
    6. Copy the raw HTTP request.  In this case, it is:
      POST /seguridad/auth HTTP/1.1
      access_token: tuTokendeAcceso
      Content-Type: application/x-www-form-urlencoded
      User-Agent: PostmanRuntime/7.30.0
      Accept: */*
      Cache-Control: no-cache
      Postman-Token: 9478ec71-e982-4889-8d24-e446c737d191
      Accept-Encoding: gzip, deflate, br
      Connection: keep-alive
      Content-Length: 39
    7. Go to Chilkat’s online tool here:
    8. Copy the above raw HTTP request into the online tool, select your programming language, and generate.
    9. If, for example, you chose to generate FoxPro, your generated code would look like this:
      LOCAL loHttp
      LOCAL lnSuccess
      LOCAL loResp
      * This example assumes the Chilkat API to have been previously unlocked.
      * See Global Unlock Sample for sample code.
      loHttp = CreateObject('Chilkat_9_5_0.Http')
      loHttp.SetRequestHeader("Accept-Encoding","gzip, deflate, br")
      loResp = loHttp.QuickRequest("POST","")
      IF (loHttp.LastMethodSuccess = 0) THEN
          ? loHttp.LastErrorText
          RELEASE loHttp
      ? STR(loResp.StatusCode)
      ? loResp.BodyStr
      RELEASE loResp
      RELEASE loHttp
    10. You can remove the line of code that adds the “Postman-Token” header, it is not needed.


Tags :