I cannot use the input-document API, please advise

Share ideas, ask questions, and get feedback about developing for ProcessMaker

Moderator: amosbatto

Forum rules
Please post new questions under "Developing processes & programming" for ProcessMaker 2 or 3.
danmarina
Posts: 1
Joined: Mon Sep 14, 2015 4:32 pm
Country: United States of America

I cannot use the input-document API, please advise

Unread postby danmarina » Mon Nov 09, 2015 7:02 am

Hi,
I need some help with uploading a document as input document via API as described in the PHP example at this link: http://wiki.processmaker.com/REST_API_C ... t-document

No matter what I'm doing, I keep getting the error: 400, Bad Request: This filename does not exist!.
When looking into the PM classes seems like the $_FILES is always empty. I'm new to APIs, I have no idea how debug further.

Please, let me know if anyone managed to use that piece of code to post an input-document (from another machine).

regards,
/d.

Mohinish
Posts: 12
Joined: Sun Apr 17, 2016 6:08 am
Country: Kuwait

Re: I cannot use the input-document API, please advise

Unread postby Mohinish » Sun May 15, 2016 2:39 am

Hi Danmarina ,

I'm also facing same issue.Can you advice me solution ,if you got solution of that issue.
Me also posted on forum Topic How to upload file while creating case using REST API?

Thanks alot in advance :( :cry:

amosbatto
Posts: 5566
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: I cannot use the input-document API, please advise

Unread postby amosbatto » Tue May 31, 2016 11:42 pm

Post your code and maybe someone can help you.
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)

amosbatto
Posts: 5566
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: I cannot use the input-document API, please advise

Unread postby amosbatto » Wed Jun 01, 2016 6:35 pm

In PHP you have to place the @ before the path to avoid this error. See the PHP code example.
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)

amosbatto
Posts: 5566
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: I cannot use the input-document API, please advise

Unread postby amosbatto » Wed Jun 01, 2016 9:59 pm

I found that PHP 5.5 and later has a problem using @ before the path. Instead, you have to use a CurlFile() object. I have updated the documentation. See: http://wiki.processmaker.com/REST_API_C ... t-document
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)

Mohinish
Posts: 12
Joined: Sun Apr 17, 2016 6:08 am
Country: Kuwait

Re: I cannot use the input-document API, please advise

Unread postby Mohinish » Sun Jun 05, 2016 8:58 am

Hi Amosbatto,

I'm using asp.net for saving file and passing path as parameter.
like:-
{
"inp_doc_uid":"test10111124322509756bc1b5test10",
"tas_uid": "24322509756bc1b5012c202012716621",
"app_doc_comment": "test",
"form":"workflow/public_html/test.txt"
}

Response:- "message": "Bad Request: This filename does not exist!"

Can you suggest me ,what's the issue and how to solve? Please.....
Thanks

amosbatto
Posts: 5566
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: I cannot use the input-document API, please advise

Unread postby amosbatto » Mon Jun 06, 2016 9:42 pm

Mohinish,
Your "form" needs to be a file location on the machine executing the code. Web URLs do not work. If you want to use a web URL, you need to download the file and save it to a local file, which can then be uploaded to REST.
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)

Mohinish
Posts: 12
Joined: Sun Apr 17, 2016 6:08 am
Country: Kuwait

Re: I cannot use the input-document API, please advise

Unread postby Mohinish » Tue Jun 07, 2016 11:18 am

Hi Amosbatto,

Thank You for great Support.

Mohinish
Posts: 12
Joined: Sun Apr 17, 2016 6:08 am
Country: Kuwait

Re: I cannot use the input-document API, please advise

Unread postby Mohinish » Thu Jun 09, 2016 7:36 am

Hi,

I'm uploading file by using REST API while posting everything is fine but request status is 302 Found.
Please find attached Screen shot for API Request.
Post Data.png
(28 KiB) Downloaded 10 times

Post Data are below:-
--------------------------------------------------------------------------------------------
-----------------------------71042153412624
Content-Disposition: form-data; name="0"; filename="Capture.PNG"
Content-Type: image/png

‰PNG

���
IHDR��A��c���ãÕÓ���sRGB�®Îé���gAMA��± üa���
-----------------------------71042153412624
Content-Disposition: form-data; name="inp_doc_uid"

test10111124322509756bc1b5test10
-----------------------------71042153412624
Content-Disposition: form-data; name="tas_uid"

24322509756bc1b5012c202012716621
-----------------------------71042153412624
Content-Disposition: form-data; name="app_doc_comment"

test
-----------------------------71042153412624--

---------------------------------------------------------------------------------------------
After That i'm not receiving any Response
& Request Status 302 Found.
Can anyone help in that?

Thanks You

amosbatto
Posts: 5566
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: I cannot use the input-document API, please advise

Unread postby amosbatto » Thu Jun 09, 2016 8:39 pm

A status code of 302 usually means URL redirection. See: https://en.wikipedia.org/wiki/HTTP_302
I know nothing about asp.net, but this article might help you: http://www.c-sharpcorner.com/UploadFile ... t-web-api/
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)

FelipeSolis
Posts: 1
Joined: Tue Sep 26, 2017 11:43 am
Country: Colombia

Re: I cannot use the input-document API, please advise

Unread postby FelipeSolis » Tue Sep 26, 2017 12:02 pm

Hi, I'm facing this problem with .NET too. API always return file does not exist. I would like to know if there is another way to upload the file input

amosbatto
Posts: 5566
Joined: Mon Jun 22, 2009 10:28 am
Country: Bolivia
Location: La Paz

Re: I cannot use the input-document API, please advise

Unread postby amosbatto » Tue Sep 26, 2017 9:09 pm

FelipeSolis wrote:Hi, I'm facing this problem with .NET too. API always return file does not exist. I would like to know if there is another way to upload the file input

Are you trying to use a web uploader like this or are you trying to run a script which uploads a file which already exists on the computer? Post your code. I don't know anything about .NET, but maybe I can spot something if I look at your code.
Amos B. Batto ♦ ProcessMaker Technical Documentation Writer & Forum Manager ♦ Cofounder of ILLA (http://www.illa-a.org)


Return to “Development Discussion (archived)”

Who is online

Users browsing this forum: No registered users and 3 guests