XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    REST auth in Postman

    Scheduled Pinned Locked Moved Solved REST API
    3 Posts 2 Posters 127 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      jkatz
      last edited by

      I'm trying to use Postman to test out these REST calls to XO and am having trouble setting up the authentication token cookie.

      This works in the command line:
      curl -b authenticationToken=IJqaWKJGHL9pHv64lRLa-5QH-xG-YC9wzctfv3rypm4 https://server.company.name/rest/v0/vms

      But in Postman I keep geeting 401 Unauthorized. So it seems I'm not setting up the token cookie correctly.
      829a62cc-a0cf-47ac-bf55-f4eefcc30d8a-image.png

      The format of the cookie text correct? And/or what should be used for the domain? Or do i put the ip of the xo server there? Path? I've tried a lot of variations, but still no luck.

      Thanks,
      jonathan

      1 Reply Last reply Reply Quote 0
      • DanpD Offline
        Danp Pro Support Team
        last edited by

        This is how I setup my Postman --
        7fc3eeb2-da6e-43b9-9018-eab959b4861a-image.png

        This is on the root folder, and Auth Type for all requests are set to Inherit auth from parent. {{token}} is an environmental variable, so it can easily be updated in a single location. Also, this allows you to easily switch environments to go from XOA, XO from sources, etc.

        HTH, Dan

        J 1 Reply Last reply Reply Quote 1
        • J Offline
          jkatz @Danp
          last edited by

          @Danp Yup, that will do it. Thanks. No longer pulling out my hair. 🙂

          1 Reply Last reply Reply Quote 0
          • olivierlambertO olivierlambert marked this topic as a question on
          • olivierlambertO olivierlambert has marked this topic as solved on
          • First post
            Last post