gophish / api-client-python

A Python API Client for Gophish
MIT License
45 stars 48 forks source link

Feature request - API endpoint to get campaign IDs for given API Key #7

Closed andyg1 closed 7 years ago

andyg1 commented 7 years ago

It would be really useful to have an endpoint that returns a list of just the IDs associated with an API key. For a user with a large number of large campaigns, hitting the URL:

/api/campaigns/

takes a long time to return. A new endpoint would be useful where it returns the IDs and perhaps the names of the campaigns. This payload would be much smaller.

(Background: I am playing around with exporting all data as a CSV from a python script at the command line. With this new endpoint I can find out all my campaign IDs quickly, then iterate over them to get the data. Currently the only way to do this would be to pull all the data down with the above URL/endpoint. This isn't the only time I've wished this endpoint existed, so I am sure others would make use of it.)

Edit: alternatively, add a flag to the /api/campaigns/ endpoint where you just get the basics, and not populate the "results" and "timeline" arrays, nor the "template" contents. Might be a more elegant way of doing it whilst keeping a RESTful approach to the URLs.

Thanks

jordan-wright commented 7 years ago

Hey there! Sorry for the delay. I've just added the endpoint for campaigns.summary(campaign_id=None) to get the campaign summaries. Docs are on the way shortly, but you should find this to be a much quicker endpoint.

Hope this helps! Sorry for the delay in getting that added.