Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
2 replies
Subscribers
7 subscribers
Views
2134 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Integrations
We are trying to use RESTFUL service to send JSON data to Appian. The
ganeshp
Certified Senior Developer
over 9 years ago
We are trying to use RESTFUL service to send JSON data to Appian.
The parameter is defined of any type which is a CDT. So, in the expression rule based on 'messageid' shared in request header, the request detail will be sent in response.
= httppostwithresponse(
endpoint: URL(),
paramNames: {},
paramValues: {},
headerNames: { cons!HEADER },
headerValues: {
(
TraceId: "",
SourceIpAddress: "",
SourceHostName: "",
RelayedBy: "",
ApiVersion: "",
SessionId: "",
Originator: "",
UserRole: "",
OperationName: "",
processId: ""
)
},
body: "
{
""request"": {
""gtwyReqHdr"": {
""TraceId"": ""String"",
""MessageId"": ""MESSAGE"",
""SourceIpAddress"": ""String"",
""SourceHostName"": ""String"",
""SourceTimestamp"": ""YYYY-DD-MM hh:mm:ss"",
""RelayedBy"": ""String"",
""ApiVersion"": ""String"",
...
OriginalPostID-180232
OriginalPostID-180232
Discussion posts and replies are publicly visible
0
ganeshp
Certified Senior Developer
over 9 years ago
... ""SessionId"": ""String"",
""Originator"": ""String"",
""UserRole"": ""String"",
""UserId"": ""String"",
""OperationName"": ""String""
},
""gtwyReqDtl"": {
""messageIP"": {
""EMPLOYEEDATA"": [{
""EmpID"": "&ri!employee.EmpID&",
""Name"": "&ri!employee.Name&",
""Role"": "&ri!employee.Role&"
}
}]
}
}
}
}"
)
I am able to get a response when the fields are given hardcoded values within the quotes say “123” or when the rule inputs are individual fields and not a CDT.
When it is a CDT I get the below error –
Expression evaluation error at function 'httppostwithresponse' parameter 6 [line 22]: Invalid index: Cannot index property 'EMPID' of type Text into type Text
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 9 years ago
@ganeshp Though am not sure about the http integration you are doing, I am aware of the error you are experiencing. So I could give few suggestions which might help you in resolving the error 'Cannot index property 'EMPID' of type Text into type Text':
1. Please check if the rule input 'employee' (ri!employee) is able to accept the CDT input by checking if its data type is set to 'Any Type'.
2. Next to the above, make sure that the values are passed to the ri!employee. Some times there could be a chance that the values won't be passed to the rule inputs in a desired manner especially when we pass values to rule inputs by parameter because of the improper naming in parameter when invoking the rule.
3. Further make sure that the structure of ri!employee is simple and plain, but not an array of arrays which in-case requires an index in order to access fields (in this case the way you access the attributes in ri!employee is - ri!employee[1].EmpID, ri!employee[1].Name and so on).
Let's see if we could receive any valuable suggestions from other Appian practitioners.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel