Expand my Community achievements bar.

SOLVED

I want to create a flush agent using curl command

Avatar

Level 1

Hello Team i am trying to create a Dispatcher flush using curl command but i am facing issue. Please help me to get the correct curl command so that i can utilise it. I am putting my command for your reference:-

curl -u admin:admin -F “jcr:primaryType=cq:page” -F "jcr:content/jcr:title=FlushAgent” -F "jcr:content/sling:resourceType=/cq/replication/components/agent" -F "jcr:content/template=/libs/cq/replication/templates/agent" -F "jcr:content/transportUri=http://#{dispatcher}:8080/dispatcher/invalidate.cache” -F "jcr:content/ssl=relaxed" -F "jcr:content/enabled=true" -F "jcr:content/serializationType=flush” -F "jcr:content/retryDelay=60000" -F "jcr:content/logLevel=info" -F “jcr:content/protocolHTTPMethod=GET” -F “jcr:content/protocolHTTPHeaders=CQ-Action:{action}, CQ-Handle:{path}, CQ-Path: {path}” -F "jcr:content/triggerSpecific=true" -F "jcr:content/triggerReceive=true" -F "jcr:content/noVersioning=true" http://#{publish}:8080/etc/replication/agents.publish/#{dispatcher} --insecure

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @keshavk9410 

 

The command that should work is 
curl -u admin:admin -F "jcr:primaryType=cq:Page" "jcr:content/jcr:title=FlushAgent" -F "jcr:content/sling:resourceType=cq/replication/components/agent" -F "jcr:content/jcr:title=My Custom Dispatcher Flush" -F "jcr:content/template=/libs/cq/replication/templates/agent" -F "jcr:content/transportUri=http://aem.demo/dispatcher/invalidate.cache" -F "jcr:content/ssl=relaxed" -F "jcr:content/enabled=true" -F "jcr:content/serializationType=flush" -F "jcr:content/retryDelay=60000" -F "jcr:content/logLevel=info" -F "jcr:content/protocolHTTPMethod=GET" -F "jcr:content/protocolHTTPHeaders=CQ-Action:{action}" -F "jcr:content/protocolHTTPHeaders=CQ-Handle:{path}" -F "jcr:content/protocolHTTPHeaders=CQ-Path: {path}" -F "jcr:content/triggerSpecific=true" -F "jcr:content/triggerReceive=true" -F "jcr:content/noVersioning=true" http://localhost:4502/etc/replication/agents.publish/my-custom-flush --insecure

 

The curl command you were using had cq:page instead of cq:Page(capitialized P), along with some other properties. Try the above one.

 

Hope it helps!

Thanks!

Nupur

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @keshavk9410 

 

The command that should work is 
curl -u admin:admin -F "jcr:primaryType=cq:Page" "jcr:content/jcr:title=FlushAgent" -F "jcr:content/sling:resourceType=cq/replication/components/agent" -F "jcr:content/jcr:title=My Custom Dispatcher Flush" -F "jcr:content/template=/libs/cq/replication/templates/agent" -F "jcr:content/transportUri=http://aem.demo/dispatcher/invalidate.cache" -F "jcr:content/ssl=relaxed" -F "jcr:content/enabled=true" -F "jcr:content/serializationType=flush" -F "jcr:content/retryDelay=60000" -F "jcr:content/logLevel=info" -F "jcr:content/protocolHTTPMethod=GET" -F "jcr:content/protocolHTTPHeaders=CQ-Action:{action}" -F "jcr:content/protocolHTTPHeaders=CQ-Handle:{path}" -F "jcr:content/protocolHTTPHeaders=CQ-Path: {path}" -F "jcr:content/triggerSpecific=true" -F "jcr:content/triggerReceive=true" -F "jcr:content/noVersioning=true" http://localhost:4502/etc/replication/agents.publish/my-custom-flush --insecure

 

The curl command you were using had cq:page instead of cq:Page(capitialized P), along with some other properties. Try the above one.

 

Hope it helps!

Thanks!

Nupur

Avatar

Employee

Hi @keshavk9410,

Can you try the following, and see if that helps:

 

curl -H "CQ-Action: Activate" \ 
     -H "CQ-Handle: /content/bar" \ 
     -H "Content-Length: 0" \
     -H "Content-Type: application/octet-stream" \ 
     http://_dispatcher-server-hostname_[:port]/dispatcher/invalidate.cache

 

Thanks!!

 

Avatar

Community Advisor

@keshavk9410 , you can try this curl command below:

curl -H "CQ-Action: FLUSH" \ 
-H "CQ-Handle: /content/my-sire-2" \ 
-H "Content-Length: 0" \
-H "Content-Type: application/octet-stream" \ 
http://_dispatcher-server-hostname_[:port]/dispatcher/invalidate.cache


curl -H "CQ-Action: DELETE" \ 
-H "CQ-Handle: /content/my-site-1" \ 
-H "Content-Length: 0" \
-H "Content-Type: application/octet-stream" \ 
http://_dispatcher-server-hostname_[:port]/dispatcher/invalidate.cache

The documentation can be found from Adobe's own documentation, https://blogs.adobe.com/contentmanagement/2013/08/20/how-to-send-aem-dispatcher-flush-request-via-cu....

I hope this helps,

Brian.