[chore] reworked deleted api schemas

- time entry
- custom action
- time entry activity
This commit is contained in:
Eric Schubert
2023-07-05 13:28:15 +02:00
parent 163b52194a
commit d19f1121e0
17 changed files with 670 additions and 622 deletions
+16 -1
View File
@@ -6,4 +6,19 @@ tmp/oas-generated.yml:
- '#/paths/~1api~1v3~1file_links~1{file_link_id}~1open/get/responses'
operation-4xx-response:
- '#/paths/~1api~1v3/get/responses'
- '#/paths/~1api~1v3~1work_packages~1{id}~1relations/get/responses'
no-ambiguous-paths:
- '#/paths/~1api~1v3~1queries~1{id}~1form'
- '#/paths/~1api~1v3~1queries~1{id}~1star'
- '#/paths/~1api~1v3~1queries~1{id}~1unstar'
- '#/paths/~1api~1v3~1relations~1{id}~1form'
- '#/paths/~1api~1v3~1time_entries~1activity~1{id}'
- '#/paths/~1api~1v3~1work_packages~1{id}~1activities'
- '#/paths/~1api~1v3~1work_packages~1{id}~1attachments'
- '#/paths/~1api~1v3~1work_packages~1{id}~1file_links'
- '#/paths/~1api~1v3~1work_packages~1{id}~1form'
- '#/paths/~1api~1v3~1work_packages~1{id}~1revisions'
- '#/paths/~1api~1v3~1work_packages~1{id}~1relations'
- '#/paths/~1api~1v3~1work_packages~1{id}~1watchers'
- '#/paths/~1api~1v3~1work_packages~1{id}~1available_projects'
- '#/paths/~1api~1v3~1work_packages~1{id}~1available_relation_candidates'
- '#/paths/~1api~1v3~1work_packages~1{id}~1available_watchers'
+1 -1
View File
@@ -2,7 +2,7 @@
_Status: under development_
The documentation for the APIv3 is written according to the [OpenAPI 3.0 Specification](https://swagger.io/specification/).
The specification for the APIv3 is written according to the [OpenAPI 3.1 Specification](https://spec.openapis.org/oas/latest.html).
The file in the repository is split up into many files. Some OAS (OpenAPI Specification) do not support that. You can
retrieve the complete, singular file from any OpenProject server under `/api/v3/spec.json` or `/api/v3/spec.yml`.
@@ -1,15 +1,45 @@
# Schema: Custom_ActionModel
# Schema: CustomActionModel
---
type: object
example:
_type: CustomAction
name: Change project and type
description: Changes project and type in one go
properties:
_type:
type: string
enum:
- CustomAction
name:
type: string
description: The name of the custom action
description:
type: string
description: The description for the custom action
_links:
executeImmediately:
href: "/apiChanges project and type in one go"
title: Execute Change project and type
method: post
self:
href: "/api/v3/custom_actions/2"
title: Change project and type
type: object
required:
- self
- executeImmediately
properties:
self:
allOf:
- $ref: "./link.yml"
- description: |-
This custom action
**Resource**: CustomAction
executeImmediately:
allOf:
- $ref: "./link.yml"
- description: |-
Execute this custom action.
examples:
- _type: CustomAction
name: Change project and type
description: Changes project and type in one go
_links:
executeImmediately:
href: "/api/v3/custom_actions/2/execute"
title: Execute Change project and type
method: post
self:
href: "/api/v3/custom_actions/2"
title: Change project and type
@@ -1,84 +0,0 @@
# Schema: List_time_entriesModel
---
type: object
example:
_type: Collection
total: 39
count: 2
pageSize: 2
offset: 1
_embedded:
elements:
- _type: TimeEntry
id: 5
comment:
format: plain
raw: Some comment
html: "<p>Some comment</p>"
spentOn: '2015-03-20'
hours: PT5H
createdAt: '2015-03-20T12:56:56Z'
updatedAt: '2015-03-20T12:56:56Z'
_links:
self:
href: "/api/v3/time_entries/1"
updateImmediately:
href: "/api/v3/time_entries/1"
method: patch
delete:
href: "/api/v3/time_entries/1"
method: delete
project:
href: "/api/v3/projects/1"
title: Some project
workPackage:
href: "/api/v3/work_packages/1"
title: Some work package
user:
href: "/api/v3/users/2"
title: Some user
activity:
href: "/api/v3/time_entries/activities/18"
title: Some time entry activity
- _type: TimeEntry
id: 10
comment:
format: plain
raw: Another comment
html: "<p>Another comment</p>"
spentOn: '2015-03-21'
hours: PT7H
createdAt: '2015-03-20T12:56:56Z'
updatedAt: '2015-03-20T12:56:56Z'
_links:
self:
href: "/api/v3/time_entries/2"
project:
href: "/api/v3/projects/42"
title: Some other project
workPackage:
href: "/api/v3/work_packages/541"
title: Some other work package
user:
href: "/api/v3/users/6"
title: Some other project
activity:
href: "/api/v3/time_entries/activities/14"
title: some other time entry activity
_links:
self:
href: "/api/v3/time_entries?offset=1&pageSize=2"
jumpTo:
href: "/api/v3/time_entries?offset=%7Boffset%7D&pageSize=2"
templated: true
changeSize:
href: "/api/v3/time_entries?offset=1&pageSize=%7Bsize%7D"
templated: true
nextByOffset:
href: "/api/v3/time_entries?offset=2&pageSize=2"
createTimeEntry:
href: "/api/v3/time_entries/form"
method: post
createTimeEntryImmediately:
href: "/api/v3/time_entries"
method: post
@@ -0,0 +1,78 @@
# Schema: TimeEntryActivityModel
---
type: object
required:
- _type
- id
- name
- position
- default
- _embedded
- _links
properties:
_type:
type: string
enum:
- TimeEntriesActivity
id:
type: integer
description: Time entry id
minimum: 1
name:
type: string
description: The human readable name chosen for this activity
position:
type: integer
description: The rank the activity has in a list of activities
default:
type: boolean
description: Flag to signal whether this activity is the default activity
_embedded:
type: object
required:
- projects
properties:
projects:
type: array
items:
$ref: './project_model.yml'
_links:
type: object
required:
- self
- projects
properties:
self:
allOf:
- $ref: './link.yml'
- description: |-
This time entry activity
**Resource**: TimeEntriesActivity
projects:
type: array
items:
allOf:
- $ref: './link.yml'
- description: |-
One of the projects the time entry is active in.
**Resource**: Project
examples:
- _type: TimeEntriesActivity
id: 18
name: Management
position: 8
default: false
_embedded:
projects: [ ]
_links:
self:
href: "/api/v3/time_entries/activities/18"
title: Management
projects:
- href: "/api/v3/projects/death_star_v2"
title: DeathStarV2
- href: "/api/v3/projects/star_killer_base"
title: StarKillerBase
@@ -0,0 +1,113 @@
# Schema: TimeEntryCollectionModel
---
type: object
allOf:
- $ref: './collection_model.yml'
- type: object
required:
- _links
- _embedded
properties:
_links:
type: object
required:
- self
properties:
self:
allOf:
- $ref: "./link.yml"
- description: |-
This time entry collection
**Resource**: TimeEntryCollectionModel
_embedded:
type: object
required:
- elements
properties:
elements:
type: array
items:
$ref: './time_entry_model.yml'
examples:
- _type: Collection
total: 39
count: 2
pageSize: 2
offset: 1
_embedded:
elements:
- _type: TimeEntry
id: 5
comment:
format: plain
raw: Some comment
html: "<p>Some comment</p>"
spentOn: '2015-03-20'
hours: PT5H
createdAt: '2015-03-20T12:56:56Z'
updatedAt: '2015-03-20T12:56:56Z'
_links:
self:
href: "/api/v3/time_entries/1"
updateImmediately:
href: "/api/v3/time_entries/1"
method: patch
delete:
href: "/api/v3/time_entries/1"
method: delete
project:
href: "/api/v3/projects/1"
title: Some project
workPackage:
href: "/api/v3/work_packages/1"
title: Some work package
user:
href: "/api/v3/users/2"
title: Some user
activity:
href: "/api/v3/time_entries/activities/18"
title: Some time entry activity
- _type: TimeEntry
id: 10
comment:
format: plain
raw: Another comment
html: "<p>Another comment</p>"
spentOn: '2015-03-21'
hours: PT7H
createdAt: '2015-03-20T12:56:56Z'
updatedAt: '2015-03-20T12:56:56Z'
_links:
self:
href: "/api/v3/time_entries/2"
project:
href: "/api/v3/projects/42"
title: Some other project
workPackage:
href: "/api/v3/work_packages/541"
title: Some other work package
user:
href: "/api/v3/users/6"
title: Some other project
activity:
href: "/api/v3/time_entries/activities/14"
title: some other time entry activity
_links:
self:
href: "/api/v3/time_entries?offset=1&pageSize=2"
jumpTo:
href: "/api/v3/time_entries?offset=%7Boffset%7D&pageSize=2"
templated: true
changeSize:
href: "/api/v3/time_entries?offset=1&pageSize=%7Bsize%7D"
templated: true
nextByOffset:
href: "/api/v3/time_entries?offset=2&pageSize=2"
createTimeEntry:
href: "/api/v3/time_entries/form"
method: post
createTimeEntryImmediately:
href: "/api/v3/time_entries"
method: post
@@ -0,0 +1,144 @@
# Schema: TimeEntryModel
---
type: object
properties:
id:
type: integer
description: The id of the time entry
minimum: 1
comment:
allOf:
- $ref: './formattable.yml'
- description: A comment to the time entry
spentOn:
type: string
format: date
description: The date the expenditure is booked for
hours:
type: string
format: duration
description: The time quantifying the expenditure
createdAt:
type: string
format: date-time
description: The time the time entry was created
updatedAt:
type: string
format: date-time
description: The time the time entry was last updated
_links:
type: object
required:
- self
- project
- user
- activity
properties:
self:
allOf:
- "$ref": './link.yml'
- description: |-
This time entry
**Resource**: TimeEntry
updateImmediately:
allOf:
- "$ref": './link.yml'
- description: |-
Directly perform edits on this time entry
# Conditions
**Permission**: 'edit time entries' or 'edit own time entries' if the time entry belongs to the user
update:
allOf:
- "$ref": './link.yml'
- description: |-
Form endpoint that aids in preparing and performing edits on a TimeEntry
# Conditions
**Permission**: 'edit time entries' or 'edit own time entries' if the time entry belongs to the user
delete:
allOf:
- "$ref": './link.yml'
- description: |-
Delete this time entry
# Conditions
**Permission**: 'edit time entries' or 'edit own time entries' if the time entry belongs to the user
schema:
allOf:
- "$ref": './link.yml'
- description: |-
The time entry schema
**Resource**: Schema
project:
allOf:
- "$ref": './link.yml'
- description: |-
The project the time entry is bundled in. The project might be different from the work package's project once the workPackage is moved.
**Resource**: Project
workPackage:
allOf:
- "$ref": './link.yml'
- description: |-
The work package the time entry is created on
**Resource**: WorkPackage
user:
allOf:
- "$ref": './link.yml'
- description: |-
The user the time entry tracks expenditures for
**Resource**: User
activity:
allOf:
- "$ref": './link.yml'
- description: |-
The time entry activity the time entry is categorized as
**Resource**: TimeEntriesActivity
examples:
- _type: TimeEntry
id: 42
comment:
format: plain
raw: "The force shall set me free."
html: "<p>The force shall set me free.</p>"
spentOn: '2023-01-11'
hours: 'PT4H'
createdAt: '2023-01-11T13:58:24Z'
updatedAt: '2023-01-11T13:58:24Z'
_links:
self:
href: '/api/v3/time_entries/42'
updateImmediately:
href: '/api/v3/time_entries/42'
method: patch
update:
href: '/api/v3/time_entries/42/form'
method: post
delete:
href: '/api/v3/time_entries/42'
method: delete
schema:
href: '/api/v3/time_entries/schema'
project:
href: '/api/v3/projects/11'
title: DeathStarV2
workPackage:
href: '/api/v3/work_packages/77'
title: Build new hangar
user:
href: '/api/v3/users/3'
title: Darth Vader
activity:
href: '/api/v3/time_entries/activities/1'
title: Management
@@ -1,20 +0,0 @@
# Schema: View_time_entries_activityModel
---
type: object
example:
_type: TimeEntriesActivity
id: 18
name: a autem
position: 10
default: false
_embedded:
projects...: []
_links:
self:
href: "/api/v3/time_entries/activities/18"
title: a autem
projects:
- href: "/api/v3/projects/seeded_project"
title: Seeded Project
- href: "/api/v3/projects/working-project"
title: Working Project
@@ -1,44 +0,0 @@
# Schema: View_time_entryModel
---
type: object
example:
_type: TimeEntry
id: 1
comment:
format: plain
raw: Some text explaining why the time entry was created
html: "<p>Some text explaining why the time entry was created</p>"
spentOn: '2015-03-20'
hours: PT5H
createdAt: '2015-03-20T12:56:56Z'
updatedAt: '2015-03-20T12:56:56Z'
customField12: 5
_embedded:
project...: {}
workPackage...: {}
user...: {}
activity...: {}
_links:
self:
href: "/api/v3/time_entries/1"
updateImmediately:
href: "/api/v3/time_entries/1"
method: patch
delete:
href: "/api/v3/time_entries/1"
method: delete
project:
href: "/api/v3/projects/1"
title: Some project
workPackage:
href: "/api/v3/work_packages/1"
title: Some work package
user:
href: "/api/v3/users/2"
title: Some user
activity:
href: "/api/v3/time_entries/activities/18"
title: Some time entry activity
customField4:
href: "/api/v3/users/5"
title: Some other user
+9 -9
View File
@@ -379,7 +379,7 @@ paths:
"/api/v3/time_entries/{id}/form":
"$ref": "./paths/time_entries_id_form.yml"
"/api/v3/time_entries/activity/{id}":
"$ref": "./paths/time_entries_activity_item.yml"
"$ref": "./paths/time_entry_activity.yml"
"/api/v3/time_entries/available_projects":
"$ref": "./paths/time_entries_available_projects.yml"
"/api/v3/time_entries/form":
@@ -541,9 +541,9 @@ components:
"$ref": "./components/schemas/collection_model.yml"
ConfigurationModel:
"$ref": "./components/schemas/configuration_model.yml"
Custom_ActionModel:
CustomActionModel:
"$ref": "./components/schemas/custom_action_model.yml"
Custom_OptionModel:
CustomOptionModel:
"$ref": "./components/schemas/custom_option_model.yml"
DayCollectionModel:
"$ref": "./components/schemas/day_collection_model.yml"
@@ -599,8 +599,6 @@ components:
"$ref": "./components/schemas/list_projects_model.yml"
List_projects_by_versionModel:
"$ref": "./components/schemas/list_projects_by_version_model.yml"
List_time_entriesModel:
"$ref": "./components/schemas/list_time_entries_model.yml"
MarkdownModel:
"$ref": "./components/schemas/markdown_model.yml"
NewsModel:
@@ -701,6 +699,12 @@ components:
"$ref": "./components/schemas/storage_read_model.yml"
StorageWriteModel:
"$ref": "./components/schemas/storage_write_model.yml"
TimeEntryActivityModel:
"$ref": "./components/schemas/time_entry_activity_model.yml"
TimeEntryCollectionModel:
"$ref": "./components/schemas/time_entry_collection_model.yml"
TimeEntryModel:
"$ref": "./components/schemas/time_entry_model.yml"
TypeModel:
"$ref": "./components/schemas/type_model.yml"
TypesModel:
@@ -741,10 +745,6 @@ components:
"$ref": "./components/schemas/view_membership_schema_model.yml"
View_project_statusModel:
"$ref": "./components/schemas/view_project_status_model.yml"
View_time_entries_activityModel:
"$ref": "./components/schemas/view_time_entries_activity_model.yml"
View_time_entryModel:
"$ref": "./components/schemas/view_time_entry_model.yml"
View_time_entry_schemaModel:
"$ref": "./components/schemas/view_time_entry_schema_model.yml"
View_user_schemaModel:
+25 -46
View File
@@ -1,67 +1,46 @@
# /api/v3/custom_actions/{id}
---
get:
summary: Get a custom action
tags:
- Custom actions
description: Retrieves a custom action by id.
operationId: get_custom_action
parameters:
- description: The id of the custom action to fetch
example: '1'
in: path
name: id
required: true
schema:
type: integer
- name: id
description: The id of the custom action to fetch
in: path
required: true
schema:
type: integer
example: 42
responses:
'200':
description: OK
content:
application/hal+json:
examples:
response:
value:
_links:
executeImmediately:
href: "/apiChanges project and type in one go"
method: post
title: Execute Change project and type
self:
href: "/api/v3/custom_actions/2"
title: Change project and type
_type: CustomAction
description: Changes project and type in one go
name: Change project and type
schema:
"$ref": "../components/schemas/custom_action_model.yml"
description: OK
headers: {}
$ref: '../components/schemas/custom_action_model.yml'
'403':
content:
application/hal+json:
schema:
$ref: "../components/schemas/error_response.yml"
examples:
response:
value:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
message: You are not authorized to access this resource.
$ref: '../components/schemas/error_response.yml'
example:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
message: You are not authorized to access this resource.
description: |-
Returned if the client does not have sufficient permissions.
**Required permission:** edit work packages in any project
headers: {}
'404':
description: Returned if the custom action does not exist.
content:
application/hal+json:
schema:
$ref: "../components/schemas/error_response.yml"
examples:
response:
value:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
message: The requested resource could not be found.
description: Returned if the custom action does not exist.
headers: {}
tags:
- Custom actions
description: ''
operationId: View_custom_action
summary: View custom action
$ref: '../components/schemas/error_response.yml'
example:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
message: The requested resource could not be found.
+105 -193
View File
@@ -1,214 +1,138 @@
# /api/v3/time_entries
---
get:
summary: List time entries
operationId: list_time_entries
tags:
- Time entries
description: |-
Lists time entries. The time entries returned depend on the filters
provided and also on the permission of the requesting user.
parameters:
- description: Page number inside the requested collection.
example: '25'
in: query
name: offset
required: false
schema:
default: 1
type: integer
- description: Number of elements to display per page.
example: '25'
in: query
name: pageSize
required: false
schema:
type: integer
- description: |-
JSON specifying sort criteria.
Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Currently supported sorts are:
+ id: Sort by primary key
+ hours: Sort by logged hours
+ spent_on: Sort by spent on date
+ created_at: Sort by time entry creation datetime
+ updated_at: Sort by the time the time entry was updated last
example: '[["spent_on", "asc"]]'
in: query
name: sortBy
required: false
schema:
default: '["spent_on", "asc"]'
type: string
- description: |-
JSON specifying filter conditions.
Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Currently supported filters are:
+ work_package: Filter time entries by work package
+ project: Filter time entries by project
+ user: Filter time entries by users
+ spent_on: Filter time entries by spent on date
+ created_at: Filter time entries by creation datetime
+ updated_at: Filter time entries by the last time they where updated
+ activity: Filter time entries by time entry activity
example: '[{ "work_package": { "operator": "=", "values": ["1", "2"] } }, { "project":
{ "operator": "=", "values": ["1"] } }]'
in: query
name: filters
required: false
schema:
type: string
- name: offset
description: Page number inside the requested collection.
example: 25
in: query
required: false
schema:
default: 1
type: integer
- name: pageSize
description: Number of elements to display per page.
example: '25'
in: query
required: false
schema:
type: integer
- name: sortBy
description: |-
JSON specifying sort criteria.
Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Currently supported sorts are:
+ id: Sort by primary key
+ hours: Sort by logged hours
+ spent_on: Sort by spent on date
+ created_at: Sort by time entry creation datetime
+ updated_at: Sort by the time the time entry was updated last
example: '[["spent_on", "asc"]]'
in: query
required: false
schema:
default: '["spent_on", "asc"]'
type: string
- name: filters
description: |-
JSON specifying filter conditions.
Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Currently supported filters are:
+ work_package: Filter time entries by work package
+ project: Filter time entries by project
+ user: Filter time entries by users
+ spent_on: Filter time entries by spent on date
+ created_at: Filter time entries by creation datetime
+ updated_at: Filter time entries by the last time they where updated
+ activity: Filter time entries by time entry activity
example: '[{ "work_package": { "operator": "=", "values": ["1", "2"] } }, { "project": { "operator": "=", "values": ["1"] } }]'
in: query
required: false
schema:
type: string
responses:
'200':
content:
application/hal+json:
examples:
response:
value:
_embedded:
elements:
- _links:
activity:
href: "/api/v3/time_entries/activities/18"
title: Some time entry activity
delete:
href: "/api/v3/time_entries/1"
method: delete
project:
href: "/api/v3/projects/1"
title: Some project
self:
href: "/api/v3/time_entries/1"
updateImmediately:
href: "/api/v3/time_entries/1"
method: patch
user:
href: "/api/v3/users/2"
title: Some user
workPackage:
href: "/api/v3/work_packages/1"
title: Some work package
_type: TimeEntry
comment:
format: plain
html: "<p>Some comment</p>"
raw: Some comment
createdAt: '2015-03-20T12:56:56Z'
hours: PT5H
id: 5
spentOn: '2015-03-20'
updatedAt: '2015-03-20T12:56:56Z'
- _links:
activity:
href: "/api/v3/time_entries/activities/14"
title: some other time entry activity
project:
href: "/api/v3/projects/42"
title: Some other project
self:
href: "/api/v3/time_entries/2"
user:
href: "/api/v3/users/6"
title: Some other project
workPackage:
href: "/api/v3/work_packages/541"
title: Some other work package
_type: TimeEntry
comment:
format: plain
html: "<p>Another comment</p>"
raw: Another comment
createdAt: '2015-03-20T12:56:56Z'
hours: PT7H
id: 10
spentOn: '2015-03-21'
updatedAt: '2015-03-20T12:56:56Z'
_links:
changeSize:
href: "/api/v3/time_entries?offset=1&pageSize=%7Bsize%7D"
templated: true
createTimeEntry:
href: "/api/v3/time_entries/form"
method: post
createTimeEntryImmediately:
href: "/api/v3/time_entries"
method: post
jumpTo:
href: "/api/v3/time_entries?offset=%7Boffset%7D&pageSize=2"
templated: true
nextByOffset:
href: "/api/v3/time_entries?offset=2&pageSize=2"
self:
href: "/api/v3/time_entries?offset=1&pageSize=2"
_type: Collection
count: 2
offset: 1
pageSize: 2
total: 39
schema:
"$ref": "../components/schemas/list_time_entries_model.yml"
description: OK
headers: {}
'400':
$ref: "../components/responses/invalid_request_body.yml"
'403':
content:
application/hal+json:
schema:
$ref: "../components/schemas/error_response.yml"
examples:
response:
value:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
message: You are not authorized to view this resource.
$ref: '../components/schemas/time_entry_collection_model.yml'
'400':
$ref: '../components/responses/invalid_request_body.yml'
'403':
description: Returned if the client is not logged in and login is required.
headers: {}
tags:
- Time Entries
description: Lists time entries. The time entries returned depend on the filters
provided and also on the permission of the requesting user.
operationId: List_time_entries
summary: List time entries
content:
application/hal+json:
schema:
$ref: '../components/schemas/error_response.yml'
example:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
message: You are not authorized to view this resource.
post:
summary: Create time entry
tags:
- Time entries
description: |-
Creates a new time entry applying the attributes provided in the body.
Please note that while there is a fixed set of attributes, custom fields can extend
a time entries' attributes and are accepted by the endpoint.
operationId: create_time_entry
responses:
'201':
content:
application/hal+json:
schema:
"$ref": "../components/schemas/view_time_entry_model.yml"
description: Created
headers: {}
'400':
$ref: "../components/responses/invalid_request_body.yml"
'403':
content:
application/hal+json:
schema:
$ref: "../components/schemas/error_response.yml"
$ref: '../components/schemas/time_entry_model.yml'
'400':
$ref: '../components/responses/invalid_request_body.yml'
'403':
description: |-
Returned if the client does not have sufficient permissions.
**Required permission:** Log time
content:
application/hal+json:
schema:
$ref: '../components/schemas/error_response.yml'
examples:
response:
value:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
message: You are not authorized to access this resource.
description: |-
Returned if the client does not have sufficient permissions.
**Required permission:** Log time
headers: {}
'406':
$ref: "../components/responses/missing_content_type.yml"
$ref: '../components/responses/missing_content_type.yml'
'415':
$ref: "../components/responses/unsupported_media_type.yml"
$ref: '../components/responses/unsupported_media_type.yml'
'422':
description: |-
Returned if:
* a constraint for a property was violated (`PropertyConstraintViolation`)
content:
application/hal+json:
schema:
$ref: "../components/schemas/error_response.yml"
$ref: '../components/schemas/error_response.yml'
examples:
response:
value:
@@ -218,15 +142,3 @@ post:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation
message: Work package is invalid.
description: |-
Returned if:
* a constraint for a property was violated (`PropertyConstraintViolation`)
headers: {}
tags:
- Time Entries
description: Creates a new time entry applying the attributes provided in the body.
Please note that while there is a fixed set of attributes, custom fields can extend
a time entries' attributes and are accepted by the endpoint.
operationId: Create_Time_entry
summary: Create Time entry
@@ -1,59 +0,0 @@
# /api/v3/time_entries/activity/{id}
---
get:
parameters:
- description: Time entries activity id
example: '1'
in: path
name: id
required: true
schema:
type: integer
responses:
'200':
content:
application/hal+json:
examples:
response:
value:
_embedded:
projects...: []
_links:
projects:
- href: "/api/v3/projects/seeded_project"
title: Seeded Project
- href: "/api/v3/projects/working-project"
title: Working Project
self:
href: "/api/v3/time_entries/activities/18"
title: a autem
_type: TimeEntriesActivity
default: false
id: 18
name: a autem
position: 10
schema:
"$ref": "../components/schemas/view_time_entries_activity_model.yml"
description: OK
headers: {}
'404':
content:
application/hal+json:
schema:
$ref: "../components/schemas/error_response.yml"
examples:
response:
value:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
message: The requested resource could not be found.
description: |-
Returned if the activity does not exist or if the user does not have permission to view them.
**Required permission** `view time entries`, `log time`, `edit time entries`, `edit own time entries` or `manage project activities` in any project
headers: {}
tags:
- Time Entry Activities
description: ''
operationId: View_time_entries_activity
summary: View time entries activity
+96 -151
View File
@@ -1,199 +1,144 @@
# /api/v3/time_entries/{id}
---
delete:
summary: Delete time entry
tags:
- Time entries
description: Permanently deletes the specified time entry.
operationId: delete_time_entry
parameters:
- description: Time entry id
example: '1'
in: path
name: id
required: true
schema:
type: integer
- name: id
description: Time entry id
example: 1
in: path
required: true
schema:
type: integer
responses:
'204':
description: Returned if the time entry was deleted successfully.
headers: {}
'403':
content:
application/hal+json:
schema:
$ref: "../components/schemas/error_response.yml"
examples:
response:
value:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
message: You are not authorized to access this resource.
description: Returned if the client does not have sufficient permissions
headers: {}
'404':
content:
application/hal+json:
schema:
$ref: "../components/schemas/error_response.yml"
examples:
response:
value:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
message: The requested resource could not be found.
$ref: '../components/schemas/error_response.yml'
example:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
message: You are not authorized to access this resource.
'404':
description: |-
Returned if the time entry does not exist or if the user does not have sufficient permissions to see the time entry.
**Required permission** `view time entries` in the project the time entry is assigned to or `view own time entries` for time entries belonging to the user
headers: {}
content:
application/hal+json:
schema:
$ref: '../components/schemas/error_response.yml'
example:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
message: The requested resource could not be found.
'406':
$ref: "../components/responses/missing_content_type.yml"
$ref: '../components/responses/missing_content_type.yml'
'415':
$ref: "../components/responses/unsupported_media_type.yml"
tags:
- Time Entries
description: Permanently deletes the specified time entry.
operationId: Delete_time_entry
summary: Delete time entry
$ref: '../components/responses/unsupported_media_type.yml'
get:
summary: Get time entry
tags:
- Time entries
description: Retrieves a single time entry identified by the given id.
operationId: get_time_entry
parameters:
- description: time entry id
example: '1'
in: path
name: id
required: true
schema:
type: integer
- name: id
description: time entry id
example: 1
in: path
required: true
schema:
type: integer
responses:
'200':
content:
application/hal+json:
examples:
response:
value:
_embedded:
activity...: {}
project...: {}
user...: {}
workPackage...: {}
_links:
activity:
href: "/api/v3/time_entries/activities/18"
title: Some time entry activity
customField4:
href: "/api/v3/users/5"
title: Some other user
delete:
href: "/api/v3/time_entries/1"
method: delete
project:
href: "/api/v3/projects/1"
title: Some project
self:
href: "/api/v3/time_entries/1"
updateImmediately:
href: "/api/v3/time_entries/1"
method: patch
user:
href: "/api/v3/users/2"
title: Some user
workPackage:
href: "/api/v3/work_packages/1"
title: Some work package
_type: TimeEntry
comment:
format: plain
html: "<p>Some text explaining why the time entry was created</p>"
raw: Some text explaining why the time entry was created
createdAt: '2015-03-20T12:56:56Z'
customField12: 5
hours: PT5H
id: 1
spentOn: '2015-03-20'
updatedAt: '2015-03-20T12:56:56Z'
schema:
"$ref": "../components/schemas/view_time_entry_model.yml"
description: OK
headers: {}
'404':
content:
application/hal+json:
schema:
$ref: "../components/schemas/error_response.yml"
examples:
response:
value:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
message: The requested resource could not be found.
$ref: '../components/schemas/time_entry_model.yml'
'404':
description: |-
Returned if the time entry does not exist or if the user does not have permission to view them.
**Required permission** `view time entries` in the project the time entry is assigned to or `view own time entries` for time entries belonging to the user
headers: {}
tags:
- Time Entries
description: ''
operationId: View_time_entry
summary: View time entry
**Required permission**
- `view time entries` in the project the time entry is assigned to or
- `view own time entries` for time entries belonging to the user
content:
application/hal+json:
schema:
$ref: '../components/schemas/error_response.yml'
example:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
message: The requested resource could not be found.
patch:
summary: update time entry
tags:
- Time Entries
description: |-
Updates the given time entry by applying the attributes provided in
the body. Please note that while there is a fixed set of attributes, custom fields
can extend a time entries' attributes and are accepted by the endpoint.
operationId: update_time_entry
parameters:
- description: Time entry id
example: '1'
in: path
name: id
required: true
schema:
type: integer
- name: id
description: Time entry id
example: 1
in: path
required: true
schema:
type: integer
responses:
'200':
content:
application/hal+json:
schema:
"$ref": "../components/schemas/view_time_entry_model.yml"
description: OK
headers: {}
'400':
$ref: "../components/responses/invalid_request_body.yml"
'403':
content:
application/hal+json:
schema:
$ref: "../components/schemas/error_response.yml"
examples:
response:
value:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
message: You are not authorized to access this resource.
$ref: '../components/schemas/time_entry_model.yml'
'400':
$ref: '../components/responses/invalid_request_body.yml'
'403':
description: |-
Returned if the client does not have sufficient permissions.
**Required permission:** Edit (own) time entries, depending on what time entry is being modified.
headers: {}
'406':
$ref: "../components/responses/missing_content_type.yml"
'415':
$ref: "../components/responses/unsupported_media_type.yml"
'422':
content:
application/hal+json:
schema:
$ref: "../components/schemas/error_response.yml"
examples:
response:
value:
_embedded:
details:
attribute: workPackage
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation
message: Work package is invalid.
$ref: '../components/schemas/error_response.yml'
example:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:MissingPermission
message: You are not authorized to access this resource.
headers: { }
'406':
$ref: '../components/responses/missing_content_type.yml'
'415':
$ref: '../components/responses/unsupported_media_type.yml'
'422':
description: |-
Returned if:
* a constraint for a property was violated (`PropertyConstraintViolation`)
headers: {}
tags:
- Time Entries
description: Updates the given time entry by applying the attributes provided in
the body. Please note that while there is a fixed set of attributes, custom fields
can extend a time entries' attributes and are accepted by the endpoint.
operationId: Update_Time_entry
summary: Update Time entry
content:
application/hal+json:
schema:
$ref: '../components/schemas/error_response.yml'
example:
_embedded:
details:
attribute: workPackage
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation
message: Work package is invalid.
@@ -0,0 +1,39 @@
# /api/v3/time_entries/activity/{id}
---
get:
summary: View time entries activity
operationId: get_time_entries_activity
tags:
- Time entry activities
description: Fetches the time entry activity resource by the given id.
parameters:
- name: id
description: Time entries activity id
in: path
example: 1
required: true
schema:
type: integer
responses:
'200':
description: OK
content:
application/hal+json:
schema:
$ref: '../components/schemas/time_entry_activity_model.yml'
'404':
description: |-
Returned if the activity does not exist or if the user does not have permission to view them.
**Required permission** `view time entries`, `log time`, `edit time entries`, `edit own time entries` or
`manage project activities` in any project
content:
application/hal+json:
schema:
$ref: '../components/schemas/error_response.yml'
examples:
response:
value:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
message: The requested resource could not be found.
+1 -1
View File
@@ -34,4 +34,4 @@ description: |-
| updatedAt | The time the time entry was last updated | DateTime | | READ | |
Depending on custom fields defined for time entries, additional properties might exist.
name: Time Entries
name: Time entries
@@ -21,4 +21,4 @@ description: |-
| name | The human readable name chosen for this activity | String | max 30 characters | READ | |
| position | The rank the activity has in a list of activities | Date | | READ |   |
| default | Flag to signal whether this activity is the default activity | Boolean | | READ |   |
name: Time Entry Activities
name: Time entry activities