Change project owner

Hi,
what are the possibilities to change the owner of a project?

  • Can a normal user do it or does it have to be a domain admin or super admin?
  • Is this possible through the ONE DATA UI or only through the OD API?
  • An example of how to do this would be appreciated

Thanks!

1 Like

Hi Pedro,
the only way I managed to do this so far was via ONE DATA API.

  • It should be possible for User, Group Admin, and Super Admin
  • You have to use the PUT/projects endpoint

Configuration in Postman

  • PUT <base_url>/api/v1/projects/<project_id>
  • Authorization = Bearer Token from browser inspector (F12)
  • Headers: Content-Type = application/json
  • Body = raw, JSON
    → For the body JSON I simply use the GET/projects/<project_id> response and change the owner info
    → This saves you a lot of typing because many project params are mandatory
    → An example body (=payload) is listed in the following python request

Python Request Example

import requests
import json
url = "<base_url>/api/v1/projects/02c3f5da-7601-40fa-afa1-71e82c037725"
payload = json.dumps({
  "owner": "320dae6d-11cc-473d-99d1-2c8dd83b4646",
  "id": "02c3f5da-7601-40fa-afa1-71e82c037725",
  "projectType": "USE_CASES",
  "name": "TEST | DEV",
  "description": "Test Project",
  "notes": None,
  "tags": [],
  "createdAt": "2021-09-21T11:51:29.016Z",
  "updatedAt": "2021-11-05T08:32:45.055Z",
  "access": [
    {
      "holder": {
        "type": "group",
        "ownerId": "5467b87f-28ff-4a03-9498-aba669149c26",
        "name": "Test Group",
        "tags": []
      },
      "groupRoles": [
        "0d6764a8-acce-4154-925d-36da47dd6b1b"
      ],
      "holderId": "5467b87f-28ff-4a03-9498-aba669149c26"
    }
  ],
  "domain": {
    "type": "domain",
    "id": "fc49273e-5eb7-4f5b-8f42-529dd77c763c",
    "name": "Test Domain",
    "admins": [
      {
        "type": "user",
        "ownerId": "8a7b519c-36a6-40aa-8434-c37a9de7ea0c",
        "firstName": "Technical",
        "lastName": "User"
      }
    ]
  },
  "defaultLandingPage": None,
  "viewerAccess": [],
  "secured": False,
  "ownerInformation": {
    "type": "user",
        "ownerId": "8a7b519c-36a6-40aa-8434-c37a9de7ea0c",
        "firstName": "Technical",
        "lastName": "User"
  }
})
headers = {
  'Authorization': 'Bearer <token>',
  'Content-Type': 'application/json'
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)

I hope this helps!
Magy

1 Like

Thank you @magdalena.soeldner, this worked :slight_smile:
This is what needs to be changed when doing the PUT request FYI:

1 Like