Search Assets using API via OAuth | Community
Skip to main content
saibul
New Participant
November 15, 2022
Solved

Search Assets using API via OAuth

  • November 15, 2022
  • 1 reply
  • 687 views

OS: RHEL 7.6
Server: AEM-6.5.1 SP-6.5.13

 

We already implemented our author using SAML. Now we have a requirement to expose a service to Third-party to query our assets via OAuth implementation and the final endpoint should be like below.


http://localhost:4502/bin/querybuilder.json?p.hits=selective&p.properties=sling:resourceType%20jcr:uuid%20jcr:path%20jcr:primaryType%20jcr:created%20jcr:content/jcr:lastModified%20jcr:content/metadata/dc:title%20jcr:content/metadata/dc:format%20jcr:content/metadata/tiff:ImageWidth%20jcr:content/metadata/tiff:ImageLength&fulltext=office%20desk&orderby=@jcr:score&orderby.sort=desc&type=dam:Asset&path=/content/dam&p.limit=9&p.offset=0

 

I followed this how-to-manage-the-protected-aem-resources-through-oauth-2-0-851ce4c7a5ef document and generated the token and other stuffs but the result is empty with http status 401 when I do the below CURL

 

curl -H "Authorization: Bearer <BEARER_TOKEN>" http://localhost:4502/bin/querybuilder.json?p.hits=selective&p.properties=sling:resourceType%20jcr:uuid%20jcr:path%20jcr:primaryType%20jcr:created%20jcr:content/jcr:lastModified%20jcr:content/metadata/dc:title%20jcr:content/metadata/dc:format%20jcr:content/metadata/tiff:ImageWidth%20jcr:content/metadata/tiff:ImageLength&fulltext=office%20desk&orderby=@jcr:score&orderby.sort=desc&type=dam:Asset&path=/content/dam&p.limit=9&p.offset=0

 

In this way we didnt have any scope. do we need to write any custom scope and register ? Please guide in right direction.

 

Thanks in advance for your guidance.

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 krati_garg

I believe you forgot to add the link you are following. Let me know if this is the link you are following:
https://medium.com/tech-learnings/how-to-manage-the-protected-aem-resources-through-oauth-2-0-851ce4c7a5ef

 

If, this is not the link, please post the one you are following so that we can verify the steps.

If, this is the link, then you will have to follow lot of steps before you can hit the curl command above:


curl -H "Authorization: Bearer <BEARER_TOKEN>" http://localhost:4502/bin/querybuilder.json?p.hits=selective&p.properties=sling:resourceType%20jcr:u...

1 reply

krati_garg
krati_gargAccepted solution
Employee
November 15, 2022

I believe you forgot to add the link you are following. Let me know if this is the link you are following:
https://medium.com/tech-learnings/how-to-manage-the-protected-aem-resources-through-oauth-2-0-851ce4c7a5ef

 

If, this is not the link, please post the one you are following so that we can verify the steps.

If, this is the link, then you will have to follow lot of steps before you can hit the curl command above:


curl -H "Authorization: Bearer <BEARER_TOKEN>" http://localhost:4502/bin/querybuilder.json?p.hits=selective&p.properties=sling:resourceType%20jcr:u...