There is no account creation logic for this api, you have to embedded in all your request a custom header specifying your github user token. Here is the header name: "X-Github-Token", and should contain a string.
The server will store your github token to authenticate your user. If the token you specify is not stored in database, we will ask github if this token is associated to some user, and then create a giistr user, with your github token, and the github user_id (we can get it from your token). Again if your token is not stored, we ask github to know to whom it is associated. In the case github return to our server a user_id associated to this token that we already know, we just update the actual old token, assuming the old one is no longer available.
If the token already exist, we just assume you are the right user.
Here is a list of the different routes served by the giistr backend server.
This is mainly done for debug purpose.
This route contains an url parameter (id) which is a giistr user_id. Return a specific user in database.
GET /api/v1/user/:id
None
{
"id": string,
"created_at": integer,
"updated_at": integer,
"token_id": string,
"github_user_id": string,
}
Where:
id
, is an internal giistr id generated from our owntoken_id
, is a stored github tokengithub_user_id
, is the github id of your user
See previous route, the behavior is the same, but return the whole list of users.
GET /api/v1/users
None
A list of the same object than the route for an user.
This route allow you to get a specific tag from it id
Get /api/v1/tag/:id
None
{
"id": string,
"created_at": integer,
"updated_at": integer,
"user_id": string,
"name": string,
}
Where:
user_id
, is the id of the user, the tag is associated to.name
, is the actual name of the tag
This route allow you to get all the tag associated to your current user. We will use the github token you specify in you request, to get your giistr internal user then list all you tagB
GET /api/v1/tags
None
The same object than to get a single user, but as a list
This route will create a new tag for the user you make the request with.
POST /api/v1/tag
{
"name": string,
}
{
"id": string,
"created_at": integer,
"updated_at": integer,
"user_id": string,
"name": string,
}
The giistr object representation the created tag is returned.
This route will update an existing tag. You cannot edit a tag associated to a different user than the one link to the github token associated to your request
PUT /api/v1/tag
{
"id": string
"name": optional string,
}
{
"id": string,
"created_at": integer,
"updated_at": integer,
"user_id": string,
"name": string,
}
The giistr object representation of the updated tag
This route allow you to remove a tag. You cannot delete a tag associated to a different user than the one link to the github token you use the this request
DELETE /api/v1/tag/:id
None
{
"id": string,
"created_at": integer,
"updated_at": integer,
"user_id": string,
"name": string,
}
The deleted object.
This route allow you to get a specific repo from it id, you cannot get a associated to another user.
GET /api/v1/repo/:id
None
{
"id": string,
"created_at": integer,
"updated_at": integer,
"user_id": string,
"github_repo_id": string,
}
Where:
user_id
, is the id of the user, the tag is associated to.github_repo_id
, is the github internal repo identifier
This route return all the repositories associated to the user link to the github token for this request.
GET /api/v1/repos
None
A list of the same type than the previous route.
Create a new repository for the user linked to the request.
POST /api/v1/repo
{
"github_repo_id": string,
}
{
"id": string,
"created_at": integer,
"updated_at": integer,
"user_id": string,
"github_repo_id": string,
}
the created repo.
Update a repository for the user linked to the request, the repo owner must match the user associated the token in the request.
PUT /api/v1/repo
{
"id": string
"github_repo_id": optional string,
}
{
"id": string,
"created_at": integer,
"updated_at": integer,
"user_id": string,
"github_repo_id": string,
}
The updated repo
This route allow you to remove a repo. You cannot delete a repo associated to a different user than the one link to the github token you use the this request
DELETE /api/v1/repo/:id
None
{
"id": string,
"created_at": integer,
"updated_at": integer,
"user_id": string,
"github_repo_id": string,
}
The deleted object.
This will allow you to create a association between a tag and a repository. The github token of the request must link to the same user than the tag and repository.
POST /api/v1/tag/:tag_id/repo/:repo_id this route take to url parameters which are the id of the tag, and the id of repository
None
{
"assoc": {
"id": string,
"repo_id": string,
"tag_id": string,
},
"repo": {
"id": string,
"created_at": integer,
"updated_at": integer,
"user_id": string,
"github_repo_id": string,
},
"tag": {
"id": string,
"created_at": integer,
"updated_at": integer,
"user_id": string,
"name": string,
}
}
This route allow you to delete an association of a tag with a repository
DELETE /api/v1/repo-tag-assoc/:id This route takes on url parameters which is the id of the association
None
{
"assoc": {
"id": string,
"repo_id": string,
"tag_id": string,
},
"repo": {
"id": string,
"created_at": integer,
"updated_at": integer,
"user_id": string,
"github_repo_id": string,
},
"tag": {
"id": string,
"created_at": integer,
"updated_at": integer,
"user_id": string,
"name": string,
}
}
The delete association
This will list all the tag for the specified repository. The repository must be owned by the user linked to the github token of the request.
GET /api/v1/tags/repo/:id
None
[
{
"id": string,
"created_at": integer,
"updated_at": integer,
"user_id": string,
"name": string,
},
{...}
]
The list of all the tags associated to this repository
This will list all the repositories which are associated to this tag. The tag must be owned by the user linked to the github token of the request.
GET /api/v1/repos/tag/:id
None
[
{
"id": string,
"created_at": integer,
"updated_at": integer,
"user_id": string,
"github_repo_id": string,
},
{...}
]
The list of all the repositories associated to this repository