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

Solved!
Von1974
Level 2
Does R have equiv function of utils.get_self_client()?

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.

 

0 Kudos
2 Solutions
Clรฉment_Stenac

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)

View solution in original post

0 Kudos
Von1974
Level 2
Author

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

View solution in original post

0 Kudos
2 Replies
Clรฉment_Stenac

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)

0 Kudos
Von1974
Level 2
Author

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

0 Kudos

Labels

?
Labels (3)
A banner prompting to get Dataiku