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
15934 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
Yes @venkateshamu method is POST and endpoint url taken from web API designer.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
chetany
A Score Level 1
over 8 years ago
If possible, paste a screenshot here. We can see how you are passing the parameters to the smart service. Are you passing anything in the request body?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jasmins
over 8 years ago
@chetany,I can't share screenshot that is not allowed here but for your information below mapping we did and we are not mapping anything in request Body. Because I just want to trigger startprocess() Web API.
Endpoint:"https://dummy/suite/webapi/TEST_WEBAPI_PM",
Method:POST
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
chetany
A Score Level 1
over 8 years ago
In the Web API that you have created, you are passing the parameters required to start the process model by first converting them to JSON using a!toJson(). Is the process model that is being targeted by the a!startprocess() have parameters which are mandatory? If so, then you need to pass them.
In your Web API definition, I see that you are passing them from http!request.body (and before that you are wrapping it in a!toJson).
So, you must also pass the parameters from the HTTP Query smart service also.
if the process parameters are required (mandatory) in the target process model and you are not passing them, it may cause 500 server error.
Is your process model that you are targeting takes only a single process parameter or more than one parameter? If there are multiple, you need to pass them accordingly.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
chetany
A Score Level 1
over 8 years ago
The process parameters needs to be a list of dictionary.
I think you are getting 500 error because the process parameters are not getting passed, and so the process does not start.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jasmins
over 8 years ago
@chetany Thank you very much !! it is working now .
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
chetany
A Score Level 1
over 8 years ago
Welcome :-)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Dude
A Score Level 1
over 6 years ago
a!httpQuery() is depricated instead of this, its recommended to create an integration object to call Web API. also create a connected system with basic authentication
Cancel
Vote Up
-1
Vote Down
Sign in to reply
Verify Answer
Reject Answer
Cancel
<