I am consuming a restful
web service to download a file.
I am getting a valid URL
response back. I can open the file using the
‘ViewContentURL(&URL_ID)’;
but I get an error when trying to download the file using the
‘GetAttachment’. The url
is dynamically generated by the vendor. Look at the below url example they
are sending everything together, connection, expiration time etc.
Everything is blended.
Any idea P-Code to use to download the file.
This is my People-cde:
&docResponse = CreateDocument("ABC_PACKAGE_URL",
"export_files", "V1");
&ret =
&docResponse.ParseJsonString(&jsonString1);
&COM = &docResponse.DocumentElement;
HSAD_WEBSRV_AET.HSAD_FILE_URL =
&COM.GetPropertyByName("download_url").Value;
MessageBox(0, "FILE_URL", 0, 0, "%1",
HSAD_WEBSRV_AET.HSAD_FILE_URL.Value);
&URL_ID = ABCD_WEBSRV_AET.HSAD_FILE_URL.Value;
rem ViewContentURL(&URL_ID);
/*========= Download File ===== (Crossing
fingers) **/
&FILE_NAME = "fileA.txt";
&OutboundDirectory = "/filefolder/psft/ad/pd/com/Applications/"
| &FILE_NAME;
MessageBox(0, "&URL_ID ==> ", 0, 0,
"%1", &URL_ID);
&retcd = GetAttachment(&URL_ID, "",
&target_directory);
If (&retcd = %Attachment_Failed) Then
MessageBox(0, MsgGetText(137, 1, "File
Attachment Status"), 137, 2, "GetAttachment failed");
End-If;
Error:
An invalid parameter has been passed to
the file attachment function. (2,788)
HSAD_WEBSRV_AET.HSAD_GET_FILE_URL.FieldChange PCPC:3415
Statement:31
An invalid parameter has been passed to one of the following functions: AddAttachment(), ViewAttachment(), or DeleteAttachment().
An invalid parameter has been passed to one of the following functions: AddAttachment(), ViewAttachment(), or DeleteAttachment().
URL example response:
bs%3D&response-content-disposition=attachment%3B%20filename%3DUNTHSCSPH-Main.txt&response-content-type=text%2Fplain