Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
My question is related to the use of the API python endpoint in the API Designer.
Scenario : we have one API service 'service_A' in a DSS Project A and one API service 'service_B' in a DSS project B.
service_A includes a python endpoint 'endpoint_A'.
service_B includes a python endpoint 'endpoint_B'.
Please, could you confirm if endpoint_A can call the endpoint_B ? if yes, how to implement this call in endpoint_A ?
Annie
Hi,
Yes it can, see Calling another endpoint. The example uses predict_record (assumes a prediction endpoint), but you should be able to instead call run_function for a python function.
Thanks for this information.
I read that the other endpoint in this example should be part of the same service.
'In order to facilitate this kind of setup, in a Python function or prediction endpoint, you can obtain a dataikuapi.APINodeClient that is already preconfigured to query other endpoints of the same service.'
example : result = client.predict_record("other_endpoint", {"feature1" : "value1", "feature2" : 42})
In this call, there is no parameter to specify the API service in which the 'other_endpoint' is defined.
Is there a way to add this information in the call ?
No, as the API service is the deployment unit.
In that case, you'll have to fully instantiate an APINodeClient (instead of using get_self_client), that's where you can specify the service ID.
Thanks a lot !
It is clear.