Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
e117414e
Commit
e117414e
authored
Dec 02, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2124 from NARKOZ/api
remove unnecessary API::VERSION constant
parents
46bf3a09
270a4337
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
40 additions
and
6 deletions
+40
-6
CHANGELOG
CHANGELOG
+1
-0
doc/api/README.md
doc/api/README.md
+2
-1
doc/api/notes.md
doc/api/notes.md
+13
-0
lib/api.rb
lib/api.rb
+1
-2
lib/api/entities.rb
lib/api/entities.rb
+2
-2
lib/api/notes.rb
lib/api/notes.rb
+12
-0
spec/requests/api/notes_spec.rb
spec/requests/api/notes_spec.rb
+8
-0
spec/support/api_helpers.rb
spec/support/api_helpers.rb
+1
-1
No files found.
CHANGELOG
View file @
e117414e
v 4.0.0
- [API] expose created date for hooks and SSH keys
- [API] list, create issue notes
- [API] list, create snippet notes
- [API] list, create wall notes
...
...
doc/api/README.md
View file @
e117414e
...
...
@@ -25,7 +25,7 @@ The API uses JSON to serialize data. You don't need to specify `.json` at the en
When listing resources you can pass the following parameters:
+
`page`
(default:
`1`
) - page number
+
`per_page`
(default:
`20`
, max:
`100`
) -
how many
items to list per page
+
`per_page`
(default:
`20`
, max:
`100`
) -
number of
items to list per page
## Contents
...
...
@@ -36,3 +36,4 @@ When listing resources you can pass the following parameters:
+
[
Repositories
](
https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/repositories.md
)
+
[
Issues
](
https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/issues.md
)
+
[
Milestones
](
https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/milestones.md
)
+
[
Notes
](
https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/notes.md
)
doc/api/notes.md
View file @
e117414e
...
...
@@ -57,6 +57,19 @@ Parameters:
## Single note
### Single wall note
Get a wall note.
```
GET /projects/:id/notes/:note_id
```
Parameters:
+
`id`
(required) - The ID or code name of a project
+
`note_id`
(required) - The ID of a wall note
### Single issue note
Get an issue note.
...
...
lib/api.rb
View file @
e117414e
...
...
@@ -2,8 +2,7 @@ Dir["#{Rails.root}/lib/api/*.rb"].each {|file| require file}
module
Gitlab
class
API
<
Grape
::
API
VERSION
=
'v2'
version
VERSION
,
using: :path
version
'v2'
,
using: :path
rescue_from
ActiveRecord
::
RecordNotFound
do
rack_response
({
'message'
=>
'404 Not found'
}.
to_json
,
404
)
...
...
lib/api/entities.rb
View file @
e117414e
...
...
@@ -14,7 +14,7 @@ module Gitlab
end
class
Hook
<
Grape
::
Entity
expose
:id
,
:url
expose
:id
,
:url
,
:created_at
end
class
Project
<
Grape
::
Entity
...
...
@@ -61,7 +61,7 @@ module Gitlab
end
class
SSHKey
<
Grape
::
Entity
expose
:id
,
:title
,
:key
expose
:id
,
:title
,
:key
,
:created_at
end
class
MergeRequest
<
Grape
::
Entity
...
...
lib/api/notes.rb
View file @
e117414e
...
...
@@ -17,6 +17,18 @@ module Gitlab
present
paginate
(
@notes
),
with:
Entities
::
Note
end
# Get a single project wall note
#
# Parameters:
# id (required) - The ID or code name of a project
# note_id (required) - The ID of a note
# Example Request:
# GET /projects/:id/notes/:note_id
get
":id/notes/:note_id"
do
@note
=
user_project
.
common_notes
.
find
(
params
[
:note_id
])
present
@note
,
with:
Entities
::
Note
end
# Create a new project wall note
#
# Parameters:
...
...
spec/requests/api/notes_spec.rb
View file @
e117414e
...
...
@@ -30,6 +30,14 @@ describe Gitlab::API do
end
end
describe
"GET /projects/:id/notes/:note_id"
do
it
"should return a wall note by id"
do
get
api
(
"/projects/
#{
project
.
id
}
/notes/
#{
wall_note
.
id
}
"
,
user
)
response
.
status
.
should
==
200
json_response
[
'body'
].
should
==
wall_note
.
note
end
end
describe
"POST /projects/:id/notes"
do
it
"should create a new wall note"
do
post
api
(
"/projects/
#{
project
.
id
}
/notes"
,
user
),
body:
'hi!'
...
...
spec/support/api_helpers.rb
View file @
e117414e
...
...
@@ -18,7 +18,7 @@ module ApiHelpers
#
# Returns the relative path to the requested API resource
def
api
(
path
,
user
=
nil
)
"/api/
#{
Gitlab
::
API
::
VERSION
}#{
path
}
"
+
"/api/
#{
Gitlab
::
API
.
version
}#{
path
}
"
+
# Normalize query string
(
path
.
index
(
'?'
)
?
''
:
'?'
)
+
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment