Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    How to create an Asset Directory subfolder via the API

    Scheduled Pinned Locked Moved Support
    11 Posts 3 Posters 33 Views
    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.
    • S Offline
      scusson_9923
      last edited by

      Hi,

      I am trying to follow the section "Create Directory Endpoint" on https://docs.inedo.com/docs/proget-reference-api-asset-directories-api and I am unable to create a subfolder with the following command:
      

      curl POST https://<ProGet_server>/endpoints/<asset_dir>/<new_dir>/ --user <user>:<password>

      I get "curl: (6) Could not resolve host: POST"

      Can the online documentation be updated to give a full example instead of "POST .../dir/«path»"

      Thanks,
      Scott

      1 Reply Last reply Reply Quote 0
      • Dan_WoolfD Offline
        Dan_Woolf inedo-engineer
        last edited by

        @scusson_9923 said in How to create an Asset Directory subfolder via the API:

        https://docs.inedo.com/docs/proget-reference-api-asset-directories-api

        Hi @scusson_9923,

        I think the issue is that you are missing the -X in your curl command which is making curl think the URL is POST instead. Could you please try the following command:

        curl -X POST https://<ProGet_server>/endpoints/<asset_dir>/<new_dir>/ --user <user>:<password>
        

        Thanks,
        Dan

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          scusson_9923 @Dan_Woolf
          last edited by

          @Dan_Woolf Hi Dan,

          When I add -X, I get:

          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
          <HTML><HEAD><TITLE>Length Required</TITLE>
          <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
          <BODY><h2>Length Required</h2>
          <hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>
          </BODY></HTML>

          when I use -d -X, I get:

          curl: (6) Could not resolve host: POST

          If it helps, our environment is load balanced with 3 web nodes.

          Thanks,
          Scott

          1 Reply Last reply Reply Quote 0
          • S Offline
            scusson_9923
            last edited by

            Hi,

            A little more info. Looking at the IIS log, I see:

            2021-12-03 19:39:41 <ProGet_ClusterIP>7 POST /endpoints/<asset_dir>/<new_dir>/ - 443 - <Machine_IP>> curl/7.55.1 - 200 0 0 78

            So we know it hits the ProGet server and returns success from IIS. Just very confused on "curl: (6) Could not resolve host: POST" from curl.

            Thanks,
            Scott

            1 Reply Last reply Reply Quote 0
            • rhessingerR Offline
              rhessinger inedo-engineer
              last edited by

              Hi @scusson_9923,

              I just wanted to make sure you were using the correct URL. It should be https://<ProGet_server>/endpoints/<asset_dir>/dir/<new_dir>/ I wanted to make sure you had the dir URL part between your asset directory and your folder path.

              What OS are you running the curl command from? I want to test this myself, but I know Linux and windows syntax can differ a bit.

              Thanks,
              Rich

              Products Engineer, Inedo

              S 1 Reply Last reply Reply Quote 0
              • S Offline
                scusson_9923 @rhessinger
                last edited by

                @rhessinger Hi Rich,

                Thanks! Adding the /dir/ worked. I still get the "curl: (6) Could not resolve host: POST" error on Windows. Linux is "curl: (6) Could not resolve host: POST; Unknown error". Can your online documentation be updated with the full command?

                curl -d -X POST https://<ProGet_server>/endpoints/<asset_dir>/dir/<new_dir>/ --user <usename>:<password>

                Thanks again,
                Scott

                1 Reply Last reply Reply Quote 0
                • rhessingerR Offline
                  rhessinger inedo-engineer
                  last edited by

                  Hi @scusson_9923,

                  It looks like the issue in the command is that you are using -d but not providing a value for it. So what is happening is that the -X is being treated as the value of -d and POST is being treated as the host. You should either use just -d or remove the -d and use -X POST instead. I'm sorry I missed this before, but curl is not the best with error messages.

                  As for our documentation, it is meant as general documentation. Mainly, you need to make a POST/GET/etc.. request to that URL. You can use any tool you would like (curl, Invoke-WebRequest, Postman, etc...) or call from your code directly.

                  If this is something you are planning to use a lot, I would suggest that you add your own custom Feed Usage Instructions or Package Install Instructions for your Asset Directory.

                  Thanks,
                  Rich

                  Products Engineer, Inedo

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    scusson_9923
                    last edited by

                    @scusson_9923Hi Rich,

                    if I just use -X I get the return:
                    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">

                    <HTML><HEAD><TITLE>Length Required</TITLE>
                    <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
                    <BODY><h2>Length Required</h2>
                    <hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>
                    </BODY></HTML>

                    We plan on adding this in an automated build scenario, so there is a good chance we'll be using this regularly.

                    Thanks,
                    Scott

                    1 Reply Last reply Reply Quote 0
                    • rhessingerR Offline
                      rhessinger inedo-engineer
                      last edited by

                      Hi @scusson_9923,

                      So after some further testing. I figured out this to be the valid request:

                      curl -d "" -X POST --user <username>:<password> http://proget.localhost/endpoints/public-files/dir/cli-api-test/
                      

                      You could also use api:<API key> for the --user parameter. The last time I tested CURL, I didn't need to include the -d "", nor does their documentation. Using only -X apparently ignores the content-length header where -d "" will add a content-length of 0.

                      Hope this helps!

                      Thanks,
                      Rich

                      Products Engineer, Inedo

                      S 1 Reply Last reply Reply Quote 0
                      • S Offline
                        scusson_9923 @rhessinger
                        last edited by

                        @rhessinger Hi Rich,

                        Works perfectly now.
                        

                        Thanks!

                        Scott

                        1 Reply Last reply Reply Quote 0
                        • rhessingerR Offline
                          rhessinger inedo-engineer
                          last edited by

                          Hi @scusson_9923,

                          Glad to hear it! Thanks for following up as well!

                          Thanks,
                          Rich

                          Products Engineer, Inedo

                          1 Reply Last reply Reply Quote 0

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better 💗

                          Register Login
                          • 1 / 1
                          • First post
                            Last post
                          Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation