Jump to content

Curl BE frustration....


This topic is 2566 days old. Please don't post here. Open a new topic instead.

Recommended Posts

HI Guys,

I have been at this for hours and my brain (and my body) can't take it anymore.

I have the Base Elements free plugin installed. I tried to go through the docs.

Here's what I'm trying to do: Use an API:

curl --data "api_key=101ab54dbdad0ddca616e3&req_type=allLists" http://api.easysendy.com/ver1/listAPI

(I've changed the API but you get the idea...)

Trying to use "Insert from URL" into a field. (tried container, etc) and nothing works.

I know the API is correct because it works from my cmd prompt on windows) and I get back:

    {"status":"success","count":2,"listsData":[{"list_uid":"nr676yq0mz408","name":"testing","display_name":"test","description":"testing"},{"list_uid":"qn8724ssf1ccb","name":"Test","display_name":"Test","description":"This is a test list to figure out how to use this service."}]}

But I can't for the life of me get filemaker to do it. I tried the BE_HTTP_Get, I tried the Geist generator. I'm lost here.

I can even get FM (through the data viewer) to spit out the correct URL (using "\" for the needed quotes...I just can get any response.)

(connection error from the script debugger)

Any suggestions on how I can send: curl --data "api_key=101ab54dbdad0ddca616e3&req_type=allLists" http://api.easysendy.com/ver1/listAPI

out of filemaker?

Thanks,

Al,I need a beer....or 2 or 3....

 

 

Link to comment
Share on other sites

I tried with MBS Plugin:

 

#Start new session

Set Variable [$curl; Value:MBS("CURL.New")]

#Set URL to load (HTTP, HTTPS, FTP, FTPS, SFTP, etc.)

Set Variable [$result; Value:MBS("CURL.SetOptionURL"; $curl; "http://api.easysendy.com/ver1/listAPI")]

Set Variable [$result; Value:MBS("CURL.SetInputText"; $curl; "api_key=101ab54dbdad0ddca616e3&req_type=allLists")]

Set Variable [$result; Value:MBS("CURL.SetOptionUpload"; $curl; 1)]

#RUN now

Set Field [CURL Test::Result; MBS("CURL.Perform"; $curl)]

#Check result

Set Field [CURL Test::Text; MBS("CURL.GetResultAsText"; $curl; "UTF8")]

Set Field [CURL Test::debug; MBS("CURL.GetDebugAsText"; $curl)]

#Cleanup

Set Variable [$result; Value:MBS("CURL.Cleanup"; $curl)]

 

 

But this gives error about missing public key. 

So question: Why not https?

And could it be you need a SSL client key to connect?

Link to comment
Share on other sites

@MBS, While it's a great plugin, (heard great things about it), I'm a one man shop, and I use FM just for myself, not a paid developer. i.e. it's too expensive.

I can connect via cmd in windows with no SSL, the key was that I changed the key. I guess it doesn't matter if I put it out there....

curl --data "api_key=101ab54dbdad0ddeabfeb648f914c0b8bca616e3&req_type=allLists" http://api.easysendy.com/ver1/listAPI

Using that in CMD does return the correct response. Just FMP that I can't get it to play. I tried text, container, webviewer. Everything I could google....

@Josh, had not thought of the POST function, but just tried it and no love...

I also just checked with Goya and they want $199 for support. (don't blame them but it's steep for one issue). For that money I would get MBS but I can't really justify the expenditure...Amazing that FMP after 15 versions can't communicate with the web easily...Heck still can't send html email without help. I wonder sometimes that even though I love the emperor, he isn't buck naked...nah, maybe just over filemakered for today.....

 

Edited by Miron
Link to comment
Share on other sites

4 hours ago, Miron said:

 

@Josh, had not thought of the POST function, but just tried it and no love...

 

 

There shouldn't be any guessing on that; all APIs (typically) state whether you should use GET or POST to interact with them...

Link to comment
Share on other sites

@Josh, no love on BE_HTTP_POST ( "http://api.easysendy.com/ver1/listAPI"; "api_key=101ab54dbdad0ddeabfeb648f914c0b8bca616e3&req_type=allLists" )

@Wim, I agree, the api instructions say GET, but at this point I'll try anything...

@MBS I have no idea if that's the case. If it is , then it's a filemaker issue.

If there were only a way, to enter a the pure curl syntax the way it works in CMD without having FM add or subtracting anything from it....

 

 

 

 

 

Link to comment
Share on other sites

11 hours ago, Miron said:

@MBS, While it's a great plugin, (heard great things about it), I'm a one man shop, and I use FM just for myself, not a paid developer. i.e. it's too expensive.

If the plugin is too expensive, you could always contact me and discuss prices. Usually we find a way...

And in contrast to an free plugin, the paid one includes me as full time developer to help people.

Link to comment
Share on other sites

 

@Wim, I have tried so many combinations (I'm talking I was at this for hours...URL encoded, not encoded, variation, test, etc)

BE_HTTP_GET ( "curl --data" & "" & "\"" & "api_key=101ab54dbdad0ddeabfeb648f914c0b8bca616e3&req_type=allList" & "\"" & " " & "http://api.easysendy.com/ver1/listAPI")

I was trying to duplicate the success with using the cmd.exe, /so I tried switch the order where the HTTP is first, but that doesn't work in cmd.exe and doesn't match the API info...

@MBS, very kind of you. I may just take you up on that. It's a fantastic plugin that makes FMP come alive....

 

 

Link to comment
Share on other sites

Your syntax is not correct.  Check out the BE_HTTP_Set_Custom_Header function to set the curl options before using the GET to talk to the URL.

As an aside: set a variable with your request before throwing it at the BE_HTTP_GET function, that gives you a chance to review the complete URL and request in the data viewer before you feed it to the function.

Link to comment
Share on other sites

I used that function and it worked fine for me. No need to do anything else. 

Set Variable [ $result ; BE_HTTP_POST ( "http://api.easysendy.com/ver1/listAPI"; "api_key=101ab54dbdad0ddeabfeb648f914c0b8bca616e3&req_type=allLists" ) ]

From there, I could do whatever I wanted. But it returned to me the same list as you demo'ed earlier. What version of the plugin do you have installed?

  • Like 1
Link to comment
Share on other sites

23 minutes ago, Josh Ormond said:

I used that function and it worked fine for me. No need to do anything else. 


Set Variable [ $result ; BE_HTTP_POST ( "http://api.easysendy.com/ver1/listAPI"; "api_key=101ab54dbdad0ddeabfeb648f914c0b8bca616e3&req_type=allLists" ) ]

From there, I could do whatever I wanted. But it returned to me the same list as you demo'ed earlier. What version of the plugin do you have installed?

OMG , this WORKED!!! I don't get what I was doing wrong but I'll take and and give THANKS!!!!

I have version 3.3.4 of the Base Elements (download just a few days ago.

Funny how although it's listed as a GET function in the API docs...it's POST that got it to work.

Really appreciate it Josh. I didn't have the funds to spend on this and was about to abandon the project.

I am very grateful to everyone who contributed and I hope this thread helps someone else who runs into this any curl issues...

Alfred

P.S. I would have sworn I tried that combo... but after a while it's get overwhelming to remember exactly everything tried....

  • Like 1
Link to comment
Share on other sites

I wanted to add one more thing that might help someone trying to figure this out.

Putting it into a Set variable is what made it work. I was using Insert from URL and never got it to work.

ALL you need is the BE_HTTP_POST and in the variable and that's enough.

Could be that using insert from url adds or modifies the URL sent to where it doesn't work.

Good luck to those who follow in these footsteps....

 

Link to comment
Share on other sites

This topic is 2566 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.