Skip to content

ActivityClone

Clone activity

Attempt to clone an activity specified by an id

Request

post /v1/activity/clone/{id}

Parameters

Parameter Path/Query Type Required Notes
id path integer yes defines the id of a user

Request body

Attribute Type Required Notes
dateFrom string yes defines the first day of an activity
dateTo string yes defines the last day of an activity
timeFrom string yes defines the starting time of an activity
timeTo string yes defines the end time of an activity

Request body example

{
  "dateFrom": "2020-06-03T00:00:00.000Z",
  "timeFrom": "12:00",
  "dateTo": "2020-06-03T00:00:00.000Z",
  "timeTo": "12:00"
}
curl --location 'https://example.juno.one/v1/activity/clone/12' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZXN0QGp1bm8ub25lIiwidGVuYW50SUQiOiJkZXZlbG9wbWVudCIsImV4cCI6MTY4NTA5NTk4Nn0.pv8kavc3kNXiXFgZfSQjRCrA-HDVyIzTzNgi9IUXhEW4_1uRRgzoD2ZQTJB77u9VamGwICZeEyi3-b1PjRFMBQ' \
--header 'X-tenantID: example' \
--header 'Zone: GMT' \
--header 'Content-Type: application/json' \
--data '{
  "dateFrom": "2020-06-03",
  "timeFrom": "12:00",
  "dateTo": "2020-06-03",
  "timeTo": "12:00"
}'
import requests
import json

url = "https://example.juno.one/v1/activity/clone/12"

payload = json.dumps({
  "dateFrom": "2020-06-03",
  "timeFrom": "12:00",
  "dateTo": "2020-06-03",
  "timeTo": "12:00"
})
headers = {
  'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZXN0QGp1bm8ub25lIiwidGVuYW50SUQiOiJkZXZlbG9wbWVudCIsImV4cCI6MTY4NTA5NTk4Nn0.pv8kavc3kNXiXFgZfSQjRCrA-HDVyIzTzNgi9IUXhEW4_1uRRgzoD2ZQTJB77u9VamGwICZeEyi3-b1PjRFMBQ',
  'X-tenantID': 'example',
  'Zone': 'GMT',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
val client = OkHttpClient()
val mediaType = "application/json".toMediaType()
val body = "{\n  \"dateFrom\": \"2020-06-03\",\n  \"timeFrom\": \"12:00\",\n  \"dateTo\": \"2020-06-03\",\n  \"timeTo\": \"12:00\"\n}".toRequestBody(mediaType)
val request = Request.Builder()
  .url("https://example.juno.one/v1/activity/clone/12")
  .post(body)
  .addHeader("Authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZXN0QGp1bm8ub25lIiwidGVuYW50SUQiOiJkZXZlbG9wbWVudCIsImV4cCI6MTY4NTA5NTk4Nn0.pv8kavc3kNXiXFgZfSQjRCrA-HDVyIzTzNgi9IUXhEW4_1uRRgzoD2ZQTJB77u9VamGwICZeEyi3-b1PjRFMBQ")
  .addHeader("X-tenantID", "example")
  .addHeader("Zone", "GMT")
  .addHeader("Content-Type", "application/json")
  .build()
val response = client.newCall(request).execute()

Response

Successful response of clone activity has the status 200 with following response body:

[
  {
    "id": 1,
    "activityTypeId": {
      "id": 1,
      "name": "Andrej",
      "description": "test",
      "color": "#29a745",
      "workingHours": true,
      "approvable": true
    },
    "place": {
      "id": 1,
      "name": "test",
      "type": "CUSTOM"
    },
    "author": {
      "id": 2,
      "firstname": "test",
      "lastname": "test",
      "email": "test@juno.one",
      "avatar": "9",
      "deleted": false
    },
    "projectId": {
      "id": 13,
      "name": "test",
      "test_case_robust": true
    },
    "issueId": {
      "id": 2,
      "name": "test"
    },
    "teamId": {
      "id": 1,
      "name": "test",
      "deleted": false
    },
    "includeWeekends": true,
    "description": "test",
    "dateFrom": "2020-06-03T00:00:00.000Z",
    "dateTo": "2020-06-03T00:00:00.000Z",
    "timeFrom": "720",
    "timeTo": "720",
    "duration": 1,
    "statusId": {
      "id": 1,
      "name": "test",
      "color": "#29a745",
      "positiveFinal": false,
      "negativeFinal": false
    },
    "statusEditor": {
      "id": 2,
      "firstname": "test",
      "lastname": "test",
      "email": "test@juno.one",
      "avatar": "9",
      "deleted": false
    },
    "deleted": false,
    "created_at": "2020-06-03T00:00:00.000Z"
  }
]

400 Bad Request

{
    "timestamp": "2022-02-16T17:11:34.422+00:00",
    "status": 400,
    "error": "Bad Request",
    "message": "The request is missing id parameter",
    "path": "/v1/activity/clone/12"
}

404 Not found

{
    "timestamp": "2022-02-16T17:11:34.422+00:00",
    "status": 404,
    "error": "Not Found",
    "message": "Activity with id 30 was not found.",
    "path": "/v1/activity/clone/12"
}

406 Insufficient permision

{
    "timestamp": "2022-02-16T17:11:34.422+00:00",
    "status": 406,
    "error": "Missing permission for action",
    "message": "You do not have a permission for this action",
    "path": "/v1/activity/clone/12"
}

412 Precondition failed

{
    "timestamp": "2022-02-16T17:11:34.422+00:00",
    "status": 412,
    "error": "Precondition failed",
    "message": "You do not have permission for this action",
    "path": "/v1/activity/clone/12"
}

500 Unknown error

{
    "timestamp": "2022-02-16T17:11:34.422+00:00",
    "status": 500,
    "error": "Unknown",
    "message": "There was a problem with your request. Please contact your administrator.",
    "path": "/v1/activity/clone/12"
}