I have a requirement where user can pass document and it gets uploaded to an Appian's folder. I have created a WebAPI (Document Upload) and positive scenario is working as expected.
For Negative Scenario (When we are not passing any document):
1. In the WebAPI , it is handled as "400- Document not provided" but when testing we are getting status-200 (Untitled document from web API.txt).
Q. From where we are getting this "Untitled document from web API.txt" document. Where is it handled?
Q. How to fix default handling?
Discussion posts and replies are publicly visible
In negative scenario what's the value of local!success is it really giving you false?? I doubt that Can you check it once, It went for true statement in if condition that means it's true to start with. So try adding one more condition like checking length of the array etc.,
Thanks venkat Avuluri ,
I don't see any option to see local!success . However, I did fixed it by checking the size of the request.body.
I am just trying to figure out Appian is not taking the body as empty and from where "Untitled document from web API.txt" is being handled?
Sharing test-results from Postman
"
Puru Gope said: is not taking the body as empty
Empty Array returns false (Documented ) https://docs.appian.com/suite/help/24.4/fnc_informational_isnull.html .
Puru Gope said: from where "Untitled document from web API.txt" is being handled?
And coming to this it's taking true in if statement and trying to creating a Document for Empty values
Did you consider to use a!isnullorempty() instead of isnull()? This is the more modern approach and manages more of the edge cases.
Yes Stefan Helzle ,
I did try and the result was same. However I just don't see anywhere documented that if we don't send any document, Appian is going to create a document by itself and upload it.
Trying to understand whether it's a bug or it's the way it is handled. Even, I don't see where "Untitled document from web API.txt" is being handled.
I did try and the result was same. I don't see anywhere documented that Appian will create a document by itself and upload it if no document was passed in the body.
Also, I don't see where "Untitled document from web API.txt" part is being handled in the webAPI.
Can you post the full HTTP request you send to Appian?
Need to see the body . Null or empty also gives false for empty array .If your body coming as a empty array it will go for true statement in that if condition
PFB, the requested details:
'Binary file load error: invalid or missing file source'POST https://**********.appiancloud.com/suite/webapi/upload-test-document: { "Network": { "addresses": { "local": { "address": "1**.1*.*.2", "family": "IPv4", "port":5***6 }, "remote": { "address": "7*.***.*.*5", "family": "IPv4", "port": 443 } }, "tls": { "reused": false, "authorized": true, "authorizationError": null, "cipher": { "name": "*******-RSA-******-***-SHA256", "standardName": "TLS_***********************", "version": "TLSv1.2" }, "protocol": "TLSv1.2", "ephemeralKeyInfo": { "type": "ECDH", "name": "prime256v1", "size": 256 }, "peerCertificate": { "subject": { "commonName": "*.appiancloud.com", "alternativeNames": "DNS:*.appiancloud.com, DNS:*.api.appiancloud.com, DNS:api.appiancloud.com, DNS:*.appiancloud-dynamic.com, DNS:appiancloud.com, DNS:appiancloud-static.com, DNS:appiancloud-dynamic.com, DNS:*.appiancloud-static.com" }, "issuer": { "country": "US", "organization": "Amazon", "commonName": "Amazon RSA 2048 M03" }, "validFrom": "Oct 9 00:00:00 2024 GMT", "validTo": "Nov 7 23:59:59 2025 GMT", "fingerprint": "****************************************************", "serialNumber": "*******************************************************************" } } }, "Request Headers": { "authorization": "Basic ************************************/", "user-agent": "PostmanRuntime/7.43.0", "accept": "*/*", "cache-control": "no-cache", "postman-token": "f0843694-4b38-42e7-b136-6460c0a14053", "host": "deloitteuk.appiancloud.com", "accept-encoding": "gzip, deflate, br", "connection": "keep-alive" }, "Request Body": "{ value: null }", "Response Headers": { "date": "Tue, 21 Jan 2025 06:24:36 GMT", "content-length": "61", "connection": "keep-alive", "x-trace-id": "d7cc7121e3fc79f2a26bbfa005e6fff7", "strict-transport-security": "max-age=31536000; includeSubDomains; preload", "referrer-policy": "strict-origin-when-cross-origin", "x-frame-options": "SAMEORIGIN", "content-security-policy-report-only": "style-src 'unsafe-inline' 'self' web-assets.appian-cdn.com 'strict-dynamic' 'nonce-OThjNjMzODEtN******************************'; child-src 'none'; script-src 'self' 'unsafe-inline' 'unsafe-eval' web-assets.appian-cdn.com 'strict-dynamic' 'nonce-ZDhlMTY1YzktMDBhNi00ZTMxLWFmZjUtYTNiMWMxZWUzNjg1'; object-src https:; frame-src https:; img-src https:; default-src 'self'; font-src 'self' https: data:; report-uri /suite/rest/a/logging/latest/csp/report; report-to report;", "content-security-policy": "report-uri /suite/rest/a/logging/latest/csp/report; report-to report;", "reporting-endpoints": "report=\"/suite/rest/a/logging/latest/csp/report\"", "x-xss-protection": "1; mode=block", "requested-while-authenticated": "false", "x-robots-tag": "none" }, "Response Body": "Upload Successful: 25222 - Untitled document from web API.txt"}