Calling REST API from XHTML forms

This topic has 2 replies, 3 voices, and was last updated 5 years, 4 months ago by rashrani.

  • Author
    Posts
  • #8357
     leonard.alba
    Participant

    I have created a workflow with forms in XHTML file for requesters to fill up before submitting. One requirement is we need to pre-fill some fields with values from the resources. One example is that we need to retrieve the managed/role and fill the dropdown options with the role list. To do this I have added the script below in my XHTML file. However, it failed to retrieve that roles. The qry variable only contains {"readyState":1}.

    
    require(["org/forgerock/openidm/ui/common/delegates/ResourceDelegate"],
    	function(resourceDelegate) 
    	{
    
    		var qry = resourceDelegate.searchResource('_id sw ""', '/managed/role');
    		alert("qry: " + JSON.stringify(qry));
    		var roles = qry.result;
    		
    		for (x in roles)
    		{
    			var role = roles[x];
    			$("#selectRole").append('<option value="'+role._id+'|'+role.description+'">'+role.description+'</option>');
    		}
    	}
    );
    

    I can retrieve the roles using the following on command prommpt.

    
    curl -u openidm-admin:openidm-admin "http://localhost:8080/openidm/managed/role?_queryFilter=_id%20sw%20%22%22&_prettyPrint=true"
    

    Anyone can help?

    #10647
     Morten Lømo
    Participant

    I am also interested in the answer to this.

    Morten

    #17532
     rashrani
    Participant

    Did you get the solution for this?

    Rashmi

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

©2022 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?