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!

Unexpected URL for feed after creating with /api/management/feeds/create and endpointURL



  • I'm trying to use ProGet as an internal package repository for my organization. I want to use it to test the packaging and delivery of modules in a variety of packaging formats and feed protocols
    I want to push PowerShell modules/packages that support Prerelease / Released kinds and Production / QualityAssurance kinds of packages.
    I want to push to feeds with protocols conforming to NuGet, PSResourceGet, and Chocolatey.

    I use a PowerShell script to create a set of HTTP (not HTTPS) feed endpoints for these 12 combinations, using the V3 protocol

    I use this command:
    $feedCreationResults = Invoke-RestMethod -Uri $feedAdministrationUri -Method Post -Headers $headers -Body ($body | ConvertTo-Json -Depth 3) -ContentType 'application/json'

    where:

    $feedAdministrationUri = "http://utat022:50000/api/management/feeds/create"
    $headers  = @{ 'X-ApiKey' = $adminApiKey }
    $body = @{
          name                      = 'IntRelPSProdPushFeed'
          alternateNames            = @()
          feedType                  = 'powershell'
          active                    = $true
          cacheConnectors           = $true
          symbolServerEnabled       = $false
          stripSymbols              = $false
          stripSource               = $false
          endpointUrl               = 'http://utat022:50000/Released/Production/powershell/v3/index.json' (the word powershell is also replaced by 'nuget' and 'chocolatey' for those feed endpoints)
          connectors                = @()
          retentionRules            = @()
          variables                 = @{}
          canPublish                = $true
          packageStatisticsEnabled  = $false
          restrictPackageStatistics = $false
          deploymentRecordsEnabled  = $true
          usageRecordsEnabled       = $true
          vulnerabilitiesEnabled    = $true
          licensesEnabled           = $true
          useWithProjects           = $true
        }
    

    Using the ProGet dashboard, I can see that all 12 feeds are being created with their appropriate feed names, but...

    When I inspect the feed at
    'http://localhost:50000/feeds/IntRelPSRProdPushFeed'
    it says the feed API endpoint URL is
    http://localhost:50000/nuget/IntRelPSRProdPushFeed/

    Regardless of the ProGet feed type I use in my endpointURL (nuget, powershell, chocolatey), the feed endpoint type in ProGet is always nuget, the feed endpoint host is always 'localhost', not 'utat022', and the subpaths are missing. The "supported API" is v2 for powershell and chocolatey feeds, and "v2 and v3" only for nuget feeds

    Furthermore, attempting the command
    Register-PSRepository -Name 'IntRelPSRProdPushFeed' -SourceLocation 'http://utat022:50000/Released/Production/powershell/v3/index.json'
    results in the message

    Register-PSRepository: The specified Uri 'http://utat022:50000/Released/Production/powershell/v3/index.json' for parameter 'SourceLocation' is an invalid Web Uri. Please ensure that it meets the Web Uri requirements.
    

    Could somebody point out what I'm doing wrong?


    Log in to reply
     

  • inedo-engineer

    Hi @bill-hertzing_2810,

    It sounds like you want to enable API v3, which uses the `v3/index.json' URL suffix?

    In that case, make sure to set the useApiV3 property is set. Also, I don't think you can set all those properties on create... you may have to create, and then update.

    Also note that you cannot set the endpointUrl property, it's just readonly. That is generated based on the incoming reques, so if you're viewing it on localhost you'll see that. If you view it on myserver.corp you'll see that, etc.

    Hope that helps,
    Alana



  • Thank you. Your comments clarified a few things. I added useApiV3 = $True to the body above, and removed the incorrect use of endpointUrl. The big mistake in the above was Register-PSRepository - I needed to update Microsoft.PowerShell.PSResourceGet to the latest version, and use Register-PSResourceRepository -Name $feed.ShortName -Uri $endpointUrl -ApiVersion 'V3' -Trusted -passthru, where endpointUrl was http://<hostname>:50000/nuget/$feed.ShortName/
    Problem solved, thanks again!


Log in to reply
 

Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation