0

I am trying to create Test Automation framework for Apipgee Proxy URLs.

I am using Rest Assured Framework for Apigee proxy URLs with generating Bearer token on the fly ,Xapi Keyand use Apigee proxy URL. For now token is generated manually using CURL command . I can test well in postman. // accessToken,apiKey below is defined as string // inputrequest.getInputStream() reads JSON needed for body

response= RestAssured
           .given()
           .headers("Authorization","Bearer "+ accessToken)
           .headers("apiKey", apiKeyVar)
           .contentType("application/json")
           .body(inputrequest.getInputStream()).When()
           .post(apigeeProxyURL).then().statusCode(200).extract().response();

I am getting 401 (Unauthorized error) instead of 200. My query here to summarize--

  1. Does RestAssured Framework Supports Apigee Proxy URL .
  2. if same x-api Key and Bearer token works in postman for same end point, why its throwing an error
  3. I read some blogs with variation on how to pass x-api Key and Bearer Token

Please revert back and share directions on how to approach for REST API Automation for Apigee Proxy URLs

Thanks and Regards, Aditya Mandlekar

1 Answers1

0

Check if you are passing the apikey at the correct place . By default it should pass in the query param. Check your verifyapikey policy which you must have attached to your proxy.

  • Sure Ashish-thanks for response. I will check and revert back. In postman , we pass as part of header ,and other code snippets also suggested me to pass through header value. Need to check on "query" param. – aditya mandlekar Dec 24 '20 at 13:26
  • Ashish , Please suggest if u have any suggestions where to add apikey – aditya mandlekar Dec 28 '20 at 02:09