BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
iakrim
Obsidian | Level 7

Hi, 

I wanted to use the datahub api to get a related column from a related entity (Claim) and make it a part of the workflow of my Case entity so I can make API calls to external tools and apps. 

Using the task script : 

 

var caseRelationshipsJson = doGet("/svi-datahub/links?_relationshipName=Sinistre&_fromEntityTypeName=Dossier&_entityTypeName=Dossier&_entityId=" + svi_dossier_id );
var caseRelationItems=caseRelationshipsJson.items;

var ID_sin = caseRelationItems[1].toObjectId
execution.setVariable("ID_SINISTRE", ID_sin);

I have no idea why this does not work or how to debug it. 
Does doGet() use the authetification of the session or should I add a relative authetification token to that if so how to ? 

 

Thanks in advance. 

1 ACCEPTED SOLUTION

Accepted Solutions
iakrim
Obsidian | Level 7

Thanks for your reactivity. 

This was the solution: 
The authorization token when using the REST service task will be be included in the header automaticaly.

 

URL: 

/svi-datahub/links_relationshipName=Sinistre&_fromEntityTypeName=Dossier&_entityTypeName=Dossier&_entityId={copied ID into workflow variable} 

 in the REST URL.  

Then save the response based on JSON fields to workflow variables.

View solution in original post

6 REPLIES 6
mtlppe
SAS Employee

Hi iakrim, 

 

Which version of Visual Investigator are you running? 

 

svi-datahub-service logs would be a good place to start with, which would contain the error, if there is one. I managed to reproduce the error you are seeing and it suggests doGet() function does not exist. 

 

Cheers,

Paulius Peciura. 


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users


iakrim
Obsidian | Level 7

Hi Thanks for the reply. 
I'm on 

VI : 10.6.0
SAS Viya V.03.05
mtlppe
SAS Employee

Hi iakrim,

 

You are welcome. Did svi-datahub-service logs provide you some information in order to debug the issue further? 

 

I was about to suggest that perhaps a REST Service task will be easier to implement. It can issue an authenticated request, parse the response body and write the values from the response into a workflow variable. 

 

Cheers,

Paulius Peciura. 


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users


iakrim
Obsidian | Level 7

Hi, 

 

To give you more context I have created 2 api clients (1st one I use it to automate incremental indexation and the 2nd one I wanted it for the workflow related objects calls). 

Attacked you will find the two responses I get using an API client. And what happends if the same example is called from the browser via session credentials : 

 

1 st client used for Auto Index

1st client (for auto index)1st client (for auto index)

2nd client created following the SAS guide on github page : https://github.com/sassoftware/devsascom-rest-api-samples/blob/master/CoreServices/sasLogon.md

2nd client (following the client creation from the sas github page)2nd client (following the client creation from the sas github page)

The expected response like what happends when showing the same example: 

NAvigation callsNAvigation calls

 

Thanks for your time

mtlppe
SAS Employee
Hi iakrim,

I was made aware of a Technical Support track raised for the same issue which has now been resolved.

Cheers,
Paulius Peciura.

Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users


iakrim
Obsidian | Level 7

Thanks for your reactivity. 

This was the solution: 
The authorization token when using the REST service task will be be included in the header automaticaly.

 

URL: 

/svi-datahub/links_relationshipName=Sinistre&_fromEntityTypeName=Dossier&_entityTypeName=Dossier&_entityId={copied ID into workflow variable} 

 in the REST URL.  

Then save the response based on JSON fields to workflow variables.