Curl command usage | Community
Skip to main content
Level 9
October 16, 2015
Solved

Curl command usage

  • October 16, 2015
  • 10 replies
  • 4091 views

Hi All,

I was trying to understand what exactly are these curl commands. Tried searching but could not get exact information I wanted.

Found one link http://www.wemblog.com/2012/03/how-to-do-user-management-using-post.html.

Doubts as below :

- In AEM 5.6.1 OOTB instance, where should I run this(any curl command)

- Is there any separate tool/utility I need to make use of to run the curl commands.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by jk_kendall1

cURL is a free and open software tool, from http://curl.haxx.se/, that was first released in 1997 and is still actively maintained.  It is basically a simple client that communicates with a server.  cURL commands are easily inserted into scripts, which is useful for managing and testing servers.

If you search on 'curl' in the AEM documentation, you will run across uses such as :

REST API Guide for Workflows :  http://docs.adobe.com/docs/en/aem/6-0/develop/extending/workflows/wf-extending/wf-rest-api.html

Backup and Restore : http://docs.adobe.com/docs/en/aem/6-0/administer/content/backup-and-restore.html

I hope that helps.

10 replies

jk_kendall1Accepted solution
Level 2
October 16, 2015

cURL is a free and open software tool, from http://curl.haxx.se/, that was first released in 1997 and is still actively maintained.  It is basically a simple client that communicates with a server.  cURL commands are easily inserted into scripts, which is useful for managing and testing servers.

If you search on 'curl' in the AEM documentation, you will run across uses such as :

REST API Guide for Workflows :  http://docs.adobe.com/docs/en/aem/6-0/develop/extending/workflows/wf-extending/wf-rest-api.html

Backup and Restore : http://docs.adobe.com/docs/en/aem/6-0/administer/content/backup-and-restore.html

I hope that helps.

askdctmAuthor
Level 9
October 16, 2015

Hi Jk Kendall,

Thank you for your reply.

I had doubts (mentioned earlier) as below:

- In AEM 5.6.1 OOTB instance, where should I run this(any curl command)

- Is there any separate tool/utility I need to make use of to run the curl commands.

Level 2
October 16, 2015

If you want to run curl commands (there's not a requirement to do so), you need the curl executable (curl.exe).  You run curl from a command shell or from within a script.

For example, if you were testing a feature and wanted to get an image from the 'localhost' author instance, you need to execute the command from the same machine as the one on which you launched the AEM server instance.  Note the default action is GET and the server returns the request response to stdout.  For this example, you need to replace the username/password (-u option) and the image path with the appropriate values for your server.

C:\>curl -uTesterUserName:TesterPassword "http://localhost:4502/etc/designs/TestApp/images/TestImage.jpg" > TestImage.jpg


 

askdctmAuthor
Level 9
October 16, 2015

Hi Jk Kendall,

Thanks a lot for your reply.

I used the below command to activate a page in OOTB AEM instance and it worked perfectly. Initially was struggling a bit, but later got this to work.

curl -u admin:admin -X POST -F path="/content/geometrixx-outdoors/en/women/coats/calgary-winter" -F cmd="activate" http://localhost:4502/bin/replicate.json.

However, one query I have is as follows.

- If I have to create a very simple page in CQ with a text box which will take the path name[/content/geometrixx-outdoors/en/women/coats/calgary-winter] and a button[say Submit] to trigger this curl command, is it possible? Can you please provide me any pointers/tips/links which will help me out with this.

Level 2
October 16, 2015

Hi askdctm,

I have little context for what you are trying to accomplish and why you are focused on using cURL.

When you mention a 'submit' button, I think of a form.  You can add Form components [1] to a page and configure the action to store content when the submit button is clicked [2]. 

[1] http://docs.adobe.com/docs/en/aem/6-0/author/page-authoring/default-components/editmode.html#Form%20(group)

[2] http://docs.adobe.com/docs/en/aem/6-0/author/page-authoring/default-components/editmode.html#Action%20Type

You would not use cURL with AEM Forms, same as you would not use cURL with HTML FORMs.

I hope that helps - or maybe someone else has more helpful information.

askdctmAuthor
Level 9
October 16, 2015

Hi Jk Kendall,

Thanks a lot for your reply.

The context is as below:

1] I can activate a page by selecting the page and clicking on activate button in OOTB 5.6.1.

2]Instead of that I would like to activate any page, by means of curl command. Probably to have a very simple page in CQ, where the user gives in the path of the page to be activated and say Go.

3] From what I understood from the previous post was that, it is not possible. Is that correct?

4] Also, in OOTB 5.6.1 instance, if I hit on activate how does it currently work. I mean is a curl command triggered or there is some code written for that.

Your thoughts will be helpful here.

Level 2
October 16, 2015

Hi askdctm,

I'm hoping someone else will step in here to help you.

Let me test for understanding, though :

1) you are on an author instance (such as localhost:4502), and create a new page, and then activate the page, which results in replicating from the author instance to a publish instance (such as localhost:4503).

2) instead, you would like to activate (also known as publish or replicate) using cURL, so that a user, ON A PUBLISH INSTANCE?, can give the path of a page that is ON AN AUTHOR INSTANCE?, to be activated and say Go.

3) I did not say it is not possible, just that it is not necessary to POST using cURL.  Again, cURL is just another tool which implements the HTTP protocol to send a request to a server and accept a response, same as FireFox, Internet Explorer, Chrome, FileZilla, etc, but you can invoke cURL from within a script, same as using XMLHttpRequest in JavaScript.

4) To understand activation, search for the word 'replication'.   Such as, for AEM 5.6.1 : http://docs.adobe.com/docs/en/cq/current/deploying/replication.html 

askdctmAuthor
Level 9
October 16, 2015

Hi Jk Kendall,

Thanks a lot for your reply.

Replies on your questions as below:

1] Yes, correct.

2] No. 
I would like to activate (also known as publish or replicate) using cURL, so that a user, ON AN AUTHOR INSTANCE, can give the path of a page that is ON AN AUTHOR INSTANCE, to be activated and say Go.

Level 2
October 16, 2015

Hi askdctm,

The question you might have wanted to ask was 'how to use the Form component to invoke the replication workflow'.

I believe you can use the Form component (from the Form component group) and will not need to use cURL.

Here is an image of the Form component that

  1. has been placed onto a page
  2. selected Edit on End of Form and checked the box to display a Submit button
  3. selected Edit on Start of From to select a workflow :

[img]workflow.png[/img]

Hope this helps.

askdctmAuthor
Level 9
October 16, 2015

Hi Jk Kendall,

Any thoughts on this will be helpful.