Does R have equiv function of utils.get_self_client()?

Options
Von1974
Von1974 Registered Posts: 11 ✭✭✭✭

No idea why but previous query regarding this has been removed?!

I have the following python code, to get data from an api endpoint, but i need to create this in R rather than python. Is this possible, and if so what are the equiv commands?

from dataiku.apinode import utils

def my_api_function(pol_qte_ref):
client = utils.get_self_client()

# client is now a dataikuapi.APINodeClient, so you can use the regular methods
# to query other endpoints
result = client.lookup_record("GetData", {"pol_qte_ref" : pol_qte_ref})

Thanks in advance.

Best Answers

  • Clément_Stenac
    Clément_Stenac Dataiker, Dataiku DSS Core Designer, Registered Posts: 753 Dataiker
    Answer ✓
    Options

    Hi,

    We don't currently have an R equivalent.

    The crux of the Python version is to fetch the API key and local hostname from environment variables, but this cannot be simply replicated in R as the machinery for setting said variables is not present.

    If you accept to put hostname and/or API key in the code, you can replicate an API client directly in R - note that we don't have an API client for the API node in R, only for Python (+ code samples for some languages like Java but not R)

  • Von1974
    Von1974 Registered Posts: 11 ✭✭✭✭
    Answer ✓
    Options

    OK thanks for the response. I will get going on code translation from R to python then!

Setup Info
    Tags
      Help me…