Create a new dataset out of a connection with the OD API

Hi,
In a Workflow I’m trying to automatically create a Data Table out of a table from a connection. For that I’m using the Call /connection/{id}/dataset with the following body:

{
    "connectionType": "DB_CONNECTION",
    "tableName": "@table_name@",
    "tags": [],
    "resourceType": "DATA",
    "name": "@table_name@",
    "description": "",
    "databaseConnectionId": "@connection_id@",
    "schema": "ANALYSIS_WORK_DE",
    "target-project": "@project_id@",
    "access": [
        "UNKNOWN"
        ]
}

Unfortunately I get this error when executing the WF: {"errors":["User with id placeholder is not assigned to any project"]}

It doesn’t seem to be a rights management issue since the user I’m using in the Flexible Rest API processor has all rights for Data Tables and READ and EXECUTE for Connections. Any ideas?

You receive this error because ONE DATA needs to know your user’s “preferred project”, which is, if you are using the CLASSIC client, the project at which you are looking currently. The server always keeps track of the ID of the project at which you are currently looking. The client informs the server whenever the project changes.
The user that you are using for the requests sent from your workflow doesn’t have a preferred project set, which means, for instance, that you cannot create a data table from a connection.

The “problem” is that many parts of the API were not built as a public API but only with the interaction between CLASSIC server and CLASSIC client in mind.

to set the preferred project of your user you need to use the PATCH to /api/v1/users/me

1 Like