cancel
Showing results for 
Search instead for 
Did you mean: 

Create project from AI catalog using the R API

Create project from AI catalog using the R API

Hi All,

 

I’m trying to create a project from a dataset in the AI catalog trough the R API and I was wondering if someone has done it before.

 

I have previously used Dataset.get and Project.create_from_dataset in Python but I cannot seem to find the corresponding functions in R.

 

The function SetupProject in R doesn’t work with the dataset id from the AI catalog.

 

Has someone passed through this process and is it possible to create a project from data in the AI catalog using the R API?

 

Thanks!

Labels (1)
4 Replies

SetupProjectFromDataSource seems equivalent to the python create_from_dataset 

IraWatt_0-1641898985464.png
However I haven't been able to get it to work yet : / 

 

 

Hi Ira,

 

Thanks! I think this is exactly what I am looking for. Unfortunately, the function doesn't work for me as well 😕

0 Kudos

I kept running into the same issue, and my workaround was just using the REST API via the `httr` package. Not perfect, but if doing it programmatically is important then it gets the job done without you needing to download the data. Here is an example:

# Load packages
library(datarobot)
library(tidyverse)
library(httr)

endpoint <- "https://app.datarobot.com/api/v2"
token <- "Your Token"

ConnectToDataRobot(endpoint=endpoint, token=token)

get.url <- function(endpoint, id) {
  paste0(endpoint, "/datasets/", id, "/file/")
}

make.GET <- function(endpoint, id, token) {
  response <- GET(
    get.url(endpoint, id),
    add_headers(
      "Accept" = "text/csv",
      "Authorization" = paste0("Bearer ", token)
    )
  )
}

data.id <- "ID from AI Catalog"
project.name <- "Project Name"

response <- make.GET(endpoint, data.id, token)
content <- content(response, "text")
data <- read.csv(text=content) %>% as_tibble()

project <- SetupProject(
   dataSource = data,
   projectName = project.name
)
0 Kudos

Thanks for this code. 😎

0 Kudos