-1

I can share the real time scenario.

Step 1: Lunch the browser perform some functional test like navigate to some page and upload a image/video file

step 2: Send a authenticated post request.

{

  "predicateParams": {

    "type":"dam:Asset",

    "p.offset": "0",

    "p.limit": "-1"

  },"dateParams": {

  "group.1_daterange.lowerBound":"2021-11-19T00:10:15",

  "group.1_daterange.upperBound":"2021-11-19T23:59:15"

  } 

}

Steps 3: Read the response and find the preview URL from the response.

{
    "totalAssetsModifiedOrCreated": 1,
    "totalAssetsDeleted": 0,
    "deletedAssets": [],
    "hits": [
        {
            "path": "/content/dam/global-asset-library/Products/automation/download.jpg",
            "renditions": [
                "/content/dam/global-asset-library/Products/automation/download.jpg/jcr:content/renditions/cq5dam.web.1280.1280.jpeg"
            ],
            "metadata": {
               //Asset metadata
            },
            "previewLink": "https://qa.dam.com/content/dam/global-asset-library/Products/automation/download.jpg?qtm=1637340248265"
        }
    ],
    "status": {
        "code": "200",
        "message": "Search results found.",
        "success": true
    }
}

Step 4: Send a get request using to the preview link in the above response.

{

  "predicateParams": {

    "type":"dam:Asset",

    "p.offset": "0",

    "p.limit": "-1"

  },"dateParams": {

  "group.1_daterange.lowerBound":"2021-11-17T00:10:15",

  "group.1_daterange.upperBound":"2021-11-18T23:50:15"

  } 

}

Step 5: validate the previously published asset returned(ex: Image) Response of get request

Your help is highly appreciated. Thank You.

Nagaraju
  • 11
  • 5
  • If you are looking for someone who will make a job for you it's OK, but not here and it will not be free of charge. – Prophet Nov 22 '21 at 10:19
  • As you commented on this question https://stackoverflow.com/questions/70016384/is-there-any-way-to-send-a-api-get-request-after-performing-some-functional-step/70016667?noredirect=1#comment123853254_70016667 it is a continuation ask for that. Please let us know at what step you are failing and what error message you are getting and what you have tried? – Nandan A Nov 22 '21 at 10:37
  • @Nandan A How to send authorization(username and password) while sending Post request. I tried with RestAssured.basic("dell-sprinklr", "DellSprinklr321%$#@#"); RestAssured.baseURI = url; but am getting 401 response. – Nagaraju Nov 22 '21 at 12:43
  • `401` stands for unauthorized. You are not authorized to access that api. – Nandan A Nov 22 '21 at 14:27
  • Yes, 401 stands for unauthorized. But i am passing valid authorization details only. Using postman am able to access the that api with same details. – Nagaraju Nov 22 '21 at 14:56
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Nov 26 '21 at 08:53

1 Answers1

0

Authorization(Basic) details can be passed through

given().auth().preemptive().basic("username", "password")

preemptive() method will send the username and password irrespective of server need authentication or not.

Nagaraju
  • 11
  • 5