Getting Stared with HTTP Endpoints
  • 20 Apr 2024
  • 2 Minutes to read
  • Dark
    Light
  • PDF

Getting Stared with HTTP Endpoints

  • Dark
    Light
  • PDF

Article Summary

🚧 Documentation in Progress 🚧

We're still working on finishing up the documentation for ProGet 2024 and this article is on our TODO list. It's pretty rough outline/draft, but we figured it'd be better than nothing.

In general, pgutil is prefered. However if you need to query or work with structured data or wish to create a more advanced integrated

Authenticating to HTTP Endpoints

TODO
  • most api work with anonymous access
  • all apis generally use a key (api or pseduo) and have permissions
  • different endpoints may work differently (esp feed endpoints)
  • check the specific documentation

Preferred Endpoints

TODO
  • pgutil uses these behind the scenes
  • organized into different categories (same as pgutil)
    • documented and many have examples in PowerShell and Python

Feed Endpoints

TODO
  • these are third-party APIs and we did not design these; we implemented based on specifications and reverse engineering to work based on client tools
    • they work with client tools we've tested but may not work with your scripts
    • we do not document them

Old copy: To support third-party package formats such as NuGet, npm, etc., ProGet implements a number of third-party APIs. We provide only minimal documentation for these APIs, as they are usually either already documented elsewhere. However, you can usually find the basics by searching for specific things you want to do with the API, such as "how to search for packages using the NuGet API" or "how to publish an npm package using the API".

Native API Endpoints

We don't recommend using the Native API unless absolutely necessary; although this is used internally, we document usage and the methods are subject to change.

TODO
  • native API is a wrapper for database stored procedures
    • these can change from release to release, but rarely do in most maintenance releases
    • we do not document changes to stored procedures
  • methods are not documented on these pages, instead:
    • The Native API Methods are automatically documented by a special page in the software. To see the API Methods for your specific version, go to Administration > Reference > API Methods, or directly visit http://your-proget-installation/reference/api in your installation.

The Native API All of these methods require that an API Key with Native API Access is passed into each request; see Using API Keys for more information.

URL:
http://feeds.fd.local:2000/api/json/Feeds_CreateFeed

Header:
Content-Type: application/json

Body:
{
"Feed_Name" : "MyNewNuGetFeed",
"FeedType_Name" : "nuget",
"API_Key" : "«api-key»"
}

You can also use querystrings with the JSON-based API. To delete a license and all associated rules, we need to perform two requests:

GET or POST /api/json/Licenses_GetLicenses?key=«api-key»

The first request gives us a JSON array containing JSON objects with properties of licenses in ProGet. Each license is uniquely identified with a License_Id, which we will feed into the next request:

POST /api/json/Licenses_DeleteLicense?key=«api-key»&License_Id=«application-id»

The response contains no data, as it's just a delete, and the built-in reference documentation indicates no return.

Invoking Stored Procedures Directly

  • If you see a method listed in the method listing, you can invoke directly
  • useful for one-off applications because the code can run directly in the database, saving you the trouble of writing a full program.
  • can also use in conjunction with SELECT from database, but we do not recommend or support other modifications except when explicitly documented (like purging download records)
DECLARE @Application_Id INT

SELECT @License_Id = [License_Id] FROM [Licenses] WHERE [External_Id] = '«MIT, etc.»'

EXEC [Licenses_DeleteLicense] @License_Id = @License_Id

Was this article helpful?