Creating API Model using REST API's

Hello,

I am trying to create an API model and import a swagger specification into the Developer Portal using REST API’s

When i try to list the existing API model’s submitting a GET request at

https://enterprise.apigee.com/v1/organizations/:orgName/apimodels/

I get an HTTP 200, with an HTML sign in page back despite passing an Auth Header and a content type of application/json

When i try to create a new API model submitting a POST request at

https://enterprise.apigee.com/v1/organizations/:orgName/apimodels

I get back a 404.

Any pointers to proceed will be appreciated

HI @Rahul

Your end point is wrong. Its “api.enterprise.apigee.com”. You have it as “enterprise.apigee.com

I was able to get the API model response in JSON format. My curl command was

curl -X GET -H "Content-Type: application/json" -H "Authorization: Basic {auth}" "https://api.enterprise.apigee.com/v1/organizations/{org}/apimodels"

To create an API Model, the curl is

curl -X POST -H "Content-Type: application/json" -H "Authorization: Basic {auth}" 
-d '{
  "name": "Test",
  "displayName": "Test Display Name",
  "description": "Test Description"
}' 
"https://api.enterprise.apigee.com/v1/organizations/{org}/apimodels"

I got a valid response

Let me know if this helps, if it did, please accept my answer so that it benefits others who have similar issue

1 Like

Thank you, that makes sense. And now it works