REST CALL Problem

Hi ,

I am setting a rest call using Integration Smart Service and on the field which is text I need to sent a sprecific structure like follow:

{ { "Name": "Name1","Value": pv!Value1},{ "Name": "Name2","Value": pv!Value2}} .

I try several different scenarios but nothing is complete as expected.

Please advice me how to proceed.

Thanks in advance.

  Discussion posts and replies are publicly visible

Parents Reply Children
  • We have systems where this parameters is null and those calls are OK the problem are the call where we have parameters. 

    Here is the body of the integration:

    =a!toJson({
    "AppianID" : ri!AppianID,
    "GetProvisioningApproversInfo":{
    "SystemID":ri!SystemRolesDetails.SystemID,
    "roleID": ri!SystemRolesDetails.RoleID[1],
    "moduleID": ri!SystemRolesDetails.ModuleID,
    "employeeID":ri!SystemRolesDetails.EmployeeID,
    "ContractID" : ri!ContractID,
    "ADUserNameRequstby":ri!SystemRolesDetails.ADUserNameRequstby,
    "validTo" : ri!ValidTo,
    "validFrom" : ri!ValidFrom,
    "Parameters" : ri!Parametarts
    }})

    This is what you need?

  • 0
    Certified Lead Developer
    in reply to natasav

    OK. So this is all about "Parameters"? Which data type is "ri!Parametarts" (Is this a typo?)? String? If yes, why?

    What I see is that it seems that the API expects a list of Name/Value pairs. The easiest way to create this is like you initially did

    {
      {
        "Name": "requested",
        "Value" : ri!SystemInfo.Firewall_requestedFor
      },
      {
        "Name": "Source",
        "Value": ri!SystemInfo.Firewall_sourceAD_IP
      },
      {
        "Name": "Destination",
        "Value": ri!SystemInfo.Firewall_destinationIPs
      }
    }

    But make the rule input "Parametarts" (Typo?) an "any" type. This way you pass a data structure into the integration. Here it  is added to the internal data structure and then it is turned into JSON altogether.

    BTW an integration turns a dictionary or CDT into JSON on its own. The toJson() is not needed.

  • Now ri!parametars is text same as parametar on the other side.

    There I past an expression and save into pv!text variable for double check.

    But on my pv the value is OK ,on received site it is with addtional "".

  • 0
    Certified Lead Developer
    in reply to natasav

    If you put a string containing quotations marks into a toJson, it escapes the quotes to make it valid JSON.

    It is pretty hard to understand what you are doing. Did you try to follow my last post?