LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-06-2014, 02:25 AM   #1
tripialos
Member
 
Registered: Apr 2012
Posts: 166

Rep: Reputation: Disabled
passing text with curl to an API


Hi guys

I am trying to send automatic calls to etherpad API. What i want to do is to send a text to the pad but my spaces dont get parsed. The call to the API is as follows:
Code:
http://myetherpad.me/api/1.2.10/setText?apikey=5MyApiKEyHere&padID=mypad&text="hello"
With the above calli do get the text to be pasted on the webpad however if i enter the below

Code:
http://myetherpad.me/api/1.2.10/setText?apikey=5MyApiKEyHere&padID=mypad&text="hello again m8"
The text is not parsed because of the spaces. But if i add the ASCii character for the spaces it then works

Code:
http://myetherpad.me/api/1.2.10/setText?apikey=5MyApiKEyHere&padID=mypadD&text="hello%20again%20m8"
Thing is i want to pass whole bunch of text so my question is, is there a way for curl to automatically translate the text to ASCii?

Thanks
 
Old 10-06-2014, 10:45 AM   #2
tripialos
Member
 
Registered: Apr 2012
Posts: 166

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by tripialos View Post
Hi guys

I am trying to send automatic calls to etherpad API. What i want to do is to send a text to the pad but my spaces dont get parsed. The call to the API is as follows:
Code:
http://myetherpad.me/api/1.2.10/setText?apikey=5MyApiKEyHere&padID=mypad&text="hello"
With the above calli do get the text to be pasted on the webpad however if i enter the below

Code:
http://myetherpad.me/api/1.2.10/setText?apikey=5MyApiKEyHere&padID=mypad&text="hello again m8"
The text is not parsed because of the spaces. But if i add the ASCii character for the spaces it then works

Code:
http://myetherpad.me/api/1.2.10/setText?apikey=5MyApiKEyHere&padID=mypadD&text="hello%20again%20m8"
Thing is i want to pass whole bunch of text so my question is, is there a way for curl to automatically translate the text to ASCii?

Thanks



sorted

I splitted the url part from the data and declared it as ascii:




Quote:
curl --data-ascii "apikey=5MyApiKEyHere&padID=mypad&text="hello again m8" http://myetherpad.me/api/1.2.10/setText?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using CURL command to login Pandora and grep text rexineffect Linux - Newbie 2 08-24-2012 10:20 AM
[SOLVED] curl (or something) that just gets text ezekieldas Linux - Newbie 3 05-24-2012 04:59 PM
Download images from text file using curl Sam71 Programming 4 04-19-2011 04:59 AM
Bash - passing text with spaces to functions jax8 Programming 2 04-19-2009 11:43 PM
Passing value from a terminal to a GTK text box geekbynature Programming 1 11-26-2008 09:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration