Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Sriprasadsbhat
Active Contributor

Introduction:


In most of the customer use cases there is always request for automation and handling different API Lifecycle Management activities using exposed system APIs.In below blog will try to explore how to manage different artifacts of API Portal and API Business Hub Enterprise using APIs.

Setting up API access:


Subscribe to SAP Integration Suite Free tier plan by following blog post.

Once successfully subsrcribed to SAP Integration Suite,follow below deatiled steps to expore different capabilities of SAP API Management.

API Portal :


Once SAP Integration Suite with SAP API Management is enabled click Instances and Subscription to create instance


 

Refer SAP Help documentation for understanding different roles related to API Portal which includes below use cases

Configuring additional virtual hosts:

Using Self service admin role to configure virtual host to be used in SAP API Management
{
"role": "APIManagement.SelfService.Administrator"
}

Handling SAP API Management artifacts using APIs:

Using Administrative role we could perform CRUD operations on different APIs of SAP API Management.
{
"role": "APIPortal.Administrator"
}

 


 

Once required parameters are filled click on Create to complete instance creation.


Select created instance and click on Create Service Key to use it further to retrieve/update/delete API Portal artifacts.


Now you have ClientId,ClientSecret and tokenUrl to be used further to retireve API Portal artifacts through API.


 

API Business Hub Enterprise Portal :


Once SAP Integration Suite with SAP API Management is enabled click Instances and Subscription to create instance


 

Refer SAP Help documentation for understanding different roles related to API BHE

Application Developer role:

Using service key generated by specifying developer Id CRUD operation on applications, API packages, and API proxies and products could be done.

To successfully create an application via the API business hub enterprise, you must provide a valid developerId. This means that you must have already registered as an application developer to the API business hub enterprise service or you must have been onboarded by your adminstrator.This helps to differentiate multiple developers performing different operations on APIs.

Administrator Role:

This role helps to access the API business hub enterprise APIs (applications and attributes, API packages, API proxies and products, app developer and metering), and perform operations like create, update, and delete on various API business hub enterprise entities.


Once required parameters are filled click on Create to complete instance creation.


Select created instance and click on Create Service Key to use it further to retrieve/update/delete API Management,Business Hub Enterorise artifacts.



Exploring SAP API Management API portal APIs:


APIs related to API Portal could be accessed using below url.
https://<tenant_url>:443/apiportal/api/1.0/Management.svc

Make a metadata call to explore list of Enttity Sets you could use for API Portal.Use clientId,clientSecret and tokenURL from service key and make a call to below url.
https://<YourtenantspecificURL>:443/apiportal/api/1.0/Management.svc/$metadata

Below is list of EntitySet associated with APIPortal.






















































































API Portal
RouteRules APIProviders
Applications ApplicationAdditionalPropertys
ContentPackageMappers APIProxies
ApiportalCloneMappings TemplateFileResources
KeyMapEntryValues RatePlans
APITargetEndPoints APIResources
TemplatePolicys APIProxyEndPoints
ACLProductLinkages Resources
DestinationAndUrlMappings KeyMapEntries
APIProviderAdditionalPropertys EndPointProperties
FlowRules Policies
Documentations Certificates
APIProducts FileResources
GenericKeyMapEntryValues CacheResources
Bills PolicyTemplateContainers
VirtualHosts DefaultFaultRules
CertificateStores APIProductAdditionalProperties
Steps FaultRules
GenericKeyMapEntries ConditionalFlowRules
Developers

Lets consider one of the EntitySet : APIProvider and see how to create,read and delete it using API.

CREATE:

Url:
https://<YourTenantSpecificURL>:443/apiportal/api/1.0/Management.svc/APIProviders

Authentication: OAuth 2.0 ( use the details from Service Key generated for API Portal

Operation: POST

Sample Payload:
{
"description": "ES5_1",
"destType": "INTERNET",
"host": "sapes5.sapdevcenter.com",
"name": "ES5_1",
"trustAll": true,
"title": "ES5",
"authType": "BASIC",
"port": 443,
"pathPrefix": "/sap/opu/odata",
"useSSL": true,
"isOnPremise": false,
"cloudConnectorLocation": "null",
"url": "/iwfnd/catalogservice/ServiceCollection",
"userName": "User",
"password": "PASSWORD"
}

DELETE:

Url:
https://<YOUR_API_PORTAL_URL>:443/apiportal/api/1.0/Management.svc/APIProviders('ES5_1')

Authentication: OAuth 2.0 ( use the details from Service Key generated for API Portal)

Operation: DELETE

Sample Payload:Not Required

Exploring API Business Hub Enterprise APIs:


APIs related to API Business Hub Enterprise could be accessed using below url.
https://<YourAPIBHEUrl>:443//odata/1.0/data.svc

Make a metadata call to explore list of Enttity Sets you could use for API BHE.Use clientId,clientSecret and tokenURL from service key and make a call to below url.
https://<YourAPIBHEUrl>:443//odata/1.0/data.svc/$metadata

Below is list of EntitySet associated with API BHE.

 










































API BHE
APIMgmt.Applications
APIMgmt.APIProducts
APIMgmt.APIResources
APIMgmt.ProxyEndPoints
APIMgmt.APIProxies
APIMgmt.APIResourceDocumentations
APIMgmt.RatePlans
APIMgmt.Subscriptions
APIMgmt.Attributes
CatalogResources
Comments
Ratings

Lets consider one of the EntitySet : APIMgmt.Applications and see how to create,read and delete it using API.

CREATE:

Url:
https://<Your Business Hub Enterprise URL>:443/odata/1.0/data.svc/APIMgmt.Applications

Authentication: OAuth 2.0 ( use the details from Service Key generated for API BHE

Operation: POST

Sample Payload:
{

"id": "00000000000000000000000000000000",

"version": "1",

"title": "ES5TestSri",

"description": null,

"callbackurl": null,

"developer_id": "<DEVELOPER_ID>",

"ToSubscriptions": [{

"ToAPIProduct": [{

"__metadata": {

"uri": "APIMgmt.APIProducts('SAPES5Application')"

}

}

],
"ToRatePlan": [{
"__metadata": {
"uri": "APIMgmt.RatePlans('c07q973e-b188-40ea-af2e-71365bc95ef2')"
}
}
],
"id": "00000000000000000000000000000000"

}

]

}

Note: developer_id is optional and it is required if on behalf of other developer id we are performing CRUD operations on the API.

DELETE:

Url:
https://<YOUR_API_BHE_PORTAL_URL>:443/odata/1.0/data.svc/APIMgmt.Applications('4C71D3DF-3308-4FD7-B625-125029194873')

Authentication: OAuth 2.0 ( use the details from Service Key generated for API BHE )

Operation: DELETE

Sample Payload:Not Required

 

Conclusion


Hope this helps consultants and customer to automate SAP API Management Life Cycle Management Activities easily.

 
3 Comments
Saurabh_Kabra
Participant
Hi Sri,

Superb blog...It is great to see how API Portal(or rather overall Integration Suite portfolio) has been getting evolved with a lot of open APIs which can then be used for developing a custom application or monitoring or automation

 

Just as a note to other fellow community members...In order to trigger the APIs from the postman or any other rest client, it was mentioned in the blog to use YourtenantspecificURL but I struggled a bit to get this for my tenant as I was trying with my UI access hostname but this was wrong. Upon further hit & trial, I realized that it has to be picked from the service key."url" parameter.


The same is also true for business enterprise hub API portal and has to be picked from the respective service key.

Thought it will help someone who is as silly as I am 😉

Thanks

Saurabh
sambaran_bp
Discoverer
0 Kudos
Hi Sriprasad,

Is it possible to access this service in NEO - API Management ?

https://<neo-apiportal>/apiportal/api/1.0/Management.svc/$metadata  URL always redirect to IAS for SSO.

How can I access this service in NEO with OAuth ?

I tried to register a client  for this apiportal subscription and use the Bearer token to access the service via POSTMAN, but it didn't work !  Its redirecting to login page.

Please let me know if you had tried it for NEO and any suggestion to achieve it .

 

Thanks,

Sambaran
nishant_kathuria
Explorer
0 Kudos

Hi Sriprasad,

Thanks for the blog. I am trying to delete API Proxies from Business Hub Enterprise using service instance for apimanagement-devportal (devportal-apiaccess). I have able to GET the list of APIProxies in Business Hub Enterprise. However I get a "USER_NOT_AUTHORIZED" message when trying delete the API Proxy from Business Hub Enterprise. I assigned "role": "AuthGroup.API.Admin" for creating the service instance. 

I also created another service instance with role "AuthGroup.API.ApplicationDeveloper" and the Developer Id. I still get the "USER_NOT_AUTHORIZED" message in postman. Do I need to pass the Developer Id while generating the token or in the header or body in the DELETE call?

Your suggestions will be helpful. Is there another role needed for deleting APIProxies and API Products from Business Hub Enterprise.

 

Thanks

Nishant