Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Suggested Answer
+2
person also asked this
people also asked this
Replies
18 replies
Answers
2 answers
Subscribers
8 subscribers
Views
15922 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Integrations
Web APIs
jasmins
over 8 years ago
We have used StartProcess() function in WEBAPI with Http method "POST", when we are testing it is giving response properly ,but if we are trying to call through expression rule using httpquery function ,it is throwing "HTTP/1.1 401 Unauthorized" error,
So we have created third party credentials after these setting also we are getting error "HTTP/1.1 404 Not Found".
Please help us to know the error or we are missing any configurations.
Please find below code snippet.
with(
a!startProcess(
processModel: cons!TEST_WEBAPI_PM,
processParameters: a!fromJson(
http!request.body
),
onSuccess: a!httpResponse(
statusCode: 200,
headers: {
a!httpHeader(name: "Content-Type", value: "application/json")
},
body: a!toJson(
fv!processInfo
)
),
onError: a!httpResponse(
statusCode: 500,
headers: {
a!httpHeader(name: "Content-Type", value: "application/json")...
OriginalPostID-242297
Discussion posts and replies are publicly visible
0
jasmins
over 8 years ago
...
},
body: a!toJson(
{
error: "There was an error starting the process"
}
)
)
)
)
Calling URL of these web api in below code
a!httpQuery(
url:"
dummy/.../TEST_WEBAPI_PM",
basicAuthenticationCredentials :a!httpAuthenticationBasic(
username :a!scsField(
externalSystemKey :"test",
fieldKey :"username",
usePerUser :false()
),
password :a!scsField(
externalSystemKey :"test",
fieldKey :"password",
usePerUser :false()
),
preemptive :true()
)
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Sachin
A Score Level 1
over 8 years ago
@jasmins
Hi
Can you please check if the user account , with whom you have registered your third-party credentials has proper required rights/ privilages for the web api / data he is accessing or not
Thanks
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jasmins
over 8 years ago
for time being ,I have configured my own credentials and also to process model ,web api rule everywhere I have given security. But to access within appian ,we need third-party credentials configurations?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sowjanyav430
over 8 years ago
@jasmins..
Yes,We need third party credentials even within Appian.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
+1
chetany
A Score Level 1
over 8 years ago
httpQuery() does not support the POST method. You can however use a smart service HTTP Query Smart service which supports the POST method. That way you can test your web api through process model.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Reject Answer
Cancel
0
chetany
A Score Level 1
over 8 years ago
Check this link -
forum.appian.com/.../Connector_Functions.html
. You can see that the "method" parameter does not support "POST"
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
chetany
A Score Level 1
over 8 years ago
Yet another option to test your web api is to use the a!httpWrite() function. It however cannot be used on simple expression rule. Because it is a writer function, it needs to be used in combination with bind(). You can however use it in SAIL form, and it will work only if user interacts with some SAIL component. If your aim is just to test your web API within Appian, you can use the HTTP Query smart service from the process model. That would be convenient.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
venkateshamu
A Score Level 2
over 8 years ago
@jasmins, AFAIK the httpQuery function used for "GET" (default), "HEAD", "OPTIONS", and "TRACE" methods will not work for "POST" method. To call the POST method WEBAPI's you have to use httpwrite function which returns a writer and must be used with the bind() function. For more info you can check below links "https://forum.appian.com/suite/help/16.3/Connector_Functions.html#a-httpquery"
"https://forum.appian.com/suite/help/16.3/Connector_Functions.html#a-httpwrite".
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jasmins
over 8 years ago
@chetany : As you suggested ,I have tried to trigger it using http query smart service with post method but now I am getting "HTTP/1.1 500 Internal Server Error"
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
venkateshamu
A Score Level 2
over 8 years ago
@jasmins, could you verify endpoint and method (should be POST) which are passing as inputs to the httpquery smart services once.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
>