I want to create a flush agent using curl command

Avatar

Avatar
Level 1
keshavk9410
Level 1

Likes

0 likes

Total Posts

0 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
keshavk9410
Level 1

Likes

0 likes

Total Posts

0 posts

Correct reply

0 solutions
View profile
keshavk9410
Level 1

24-07-2020

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

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
Nupur_Jain
MVP

Likes

165 likes

Total Posts

186 posts

Correct reply

76 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Establish
MVP
Nupur_Jain
MVP

Likes

165 likes

Total Posts

186 posts

Correct reply

76 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile
Nupur_Jain
MVP

24-07-2020

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

Answers (2)

Answers (2)

Avatar

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

645 likes

Total Posts

607 posts

Correct reply

239 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

645 likes

Total Posts

607 posts

Correct reply

239 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
BrianKasingli
MVP

24-07-2020

@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.

Avatar

Avatar
Give Back 5
Employee
vanegi
Employee

Likes

392 likes

Total Posts

378 posts

Correct reply

148 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 50
View profile

Avatar
Give Back 5
Employee
vanegi
Employee

Likes

392 likes

Total Posts

378 posts

Correct reply

148 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 50
View profile
vanegi
Employee

24-07-2020

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!!