Important Update: Community URLs redirect issues are partially resolved. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Datafeed API Custom Object

Jayadattaperisa
Contributor III

Hi

 

I am executing Data feed using custom object and getting 400 bad request. Please find the below code. Can you help me with this.

 

<html>

</head>
<body>
<button type="button" class="button" onclick="executeWorkflow()" style="background-color:#002266">Datafeed</button>
</body>
</html>
<script type="text/javascript">
function executeWorkflow() {
//console.log("===>In");
var csrfToken = window.sessionStorage.getItem("x-csrf-token");
var baseURL = window.location.protocol + '//' + window.location.host + parent.parent.ArcherApp.globals['baseUrl'];
//console.log("====>" + baseURL);
var sessionToken = parent.parent.ArcherApp.globals.workpointFeatures.SessionToken;
if (sessionToken == undefined) {
sessionToken = JSON.parse(JSON.parse(atob(parent.parent.ArcherApp.globals.workpointFeatures))).SessionToken;
}
var apiurl = "/api/core/datafeed/execution";
$.ajax({
headers: {
'x-csrf-token': csrfToken, 'Authorization': 'Archer session-id=' + sessionToken, 'content-Type': 'application/json',
'Accept':'application/json,text/html,application/xhtml+xml,application/xml;q=.9,*/*;q=0.8'},
type: 'POST',
url: baseURL + apiurl ,
data: {
"DataFeedGuid": "88BBB41D-XXXX-XXXXXXXX",

  "IsReferenceFeedsIncluded": false
},
processData: false,
async: true,
dataType: 'json',
success: function (data) {
//console.log("===>"+data)
},
error: function (data) {
console.log(data)
}
});
}
</script>

6 REPLIES 6

DavidPetty
Archer Employee
Archer Employee

With custom objects, you don't need the following tags: <html></html>, </head> and <body></body>.

 

Which version of Archer are you on?

 

Also make sure that the users that will be clicking the button have read/update access to data feeds via a role.

 Advisory Consultant

Hi Dav,

 

We are using Archer 6.5. Yes the user have admin access.

Thanks.

 

Take a look at my post which has an updated custom object, https://community.rsa.com/docs/DOC-62020#comment-33915 

 Advisory Consultant

David Petty

 

Hi David,

 

First off, thank you for all the helpful posts on this topic.

 

We are interested in using a custom object like the one you linked to allow end users to kick off a data feed via a button on an application form, but we aren't comfortable granting them Read/Update to the Data Feed Manager via a role.

 

Is there a way to modify the custom object code to have it launch as a service account that has those rights instead when they click the button, rather than with their own credentials?

Hi Joshua :D

 

Glad to help.

 

Custom objects run as under the context of the user.  If you want it run the data feeds as a different user, you'd have make a call to get a session token of that another user, and the big issue with that is those credentials are stored in plain text in the browser, so that means any tech savvy user could obtain those credentials.

 

Ideally you'd have to write a "proxy" aspx page on the server that can do that so the credential are stored elsewhere.  Unfortunately I don't have any code for writing that proxy page.

 Advisory Consultant

Thanks for the quick reply, David. I think based on that we may need to go another direction with our design.

 

Appreciate all your help!