Use API to initiate watching a project


#1

When I run the API GET Projects, only already watched projects are shown. No capability exists to add a GitHub repo to the list of projects; it can only be done manually.

I need this because I am creating a tutorial about continuous integration for Meteor developers. It has a lot of automation, not only to make the tutorial cover a lot of ground quickly, but also to facilitate testing and validating the tutorial while creating it and for future regression testing (I want to know if someone’s changes will break it).

May be there aren’t a lot of other use cases, but lack of this feature puts a hole in an an otherwise 100% automated tutorial. :sob:


#2

:+1: I don’t think it does currently, but I think a good place to add this would be the https://circleci.com/docs/api#new-build endpoint. I don’t think it would be hard to have it add a new project if you ask it to kickoff a new build on an unwatched repo, I may be wrong.


#3

You should be able to create a new project on Circle with the following api call.

curl -X POST 'https://circleci.com/api/v1/project/:user/:repo/follow?circle-token=:token'

Create a command line tool to interact with CircleCI REST API
#4

That’s great!

It does just what I wanted now.

Please have a look at the tutorial I mentioned in the post that opened this thread. It contains a lot of ideas and valuable bash snippets for anyone wanting to automate their interactions with GitHub and CircleCI.

Tutorial slide shows - GitHub :: Meteor / CircleCI Continuous Integration Tutorial
Tutorial video play list - YouTube :: Meteor / CircleCI Continuous Integration Tutorial

I introduce CircleCI in Part #6 - Cloud Continuous Integration Please step through to get an idea of what I am trying to achieve.

I’m giving it away for free, (as a professional portfolio piece), so I’d be really grateful if one of you would blog about it or something.

Thanks, and thanks again for getting that working.

Sincere regards,
Martin


#5

Hey,

Is there any special reason for that API call just work with token and not with basic authentication?

Thanks!


#6

Personally, I do not like to use UID/PWD authentication in API calls. APIs are for scripting and managing passwords in scripts is problematic.

So I suspect CircleCI’s reasoning is that tokens are more secure and easier to use so why support UID/PWD as well?


#7

I had the same question and this solution worked well for me, however it would be really nice to include this in the API docs (https://circleci.com/docs/api/) so I didn’t have to come searching here for it. Would have saved me some time. Thanks!


#8

is it possible to delete “follow of project” by REST API too?


#9

Can you document this? Took me some time to arrive here.


#10

This will be added to the docs within 48 hours: https://github.com/circleci/circleci-docs/issues/319


#11