Skip to content

Calling Integration Suite Web Services for Practical Uses

Today’s blog will explore one of the APIs available inside the Business Hub. In this example, we had a request to use a REST call to download the API proxy inside API Management and then upload it back. There may be several reasons you would attempt something like this. For example, you may want backup copies for your record or love web services (I mean, who doesn’t, right?). We’ll guide you through this case and then, at the end, share where you can explore more APIs to connect to SAP products.

Pre-Setup: Getting Your Credentials

The assumption is that you have the API Portal in the BTP Cockpit. However, if not, a great ‘How To..’ blog written by Ricardo Israel Mata Viejo will guide you through that process. At the end of your setup, you should be given a .JSON file of credentials:

Integration Suite Web Services

Never share this information outside your organization/trusted network, as it contains security information to access your API portal. You’re all set for the next step once you have access to your security Json.

 

Using the APIs

Now that you have your credentials, you have much of the information you need to begin your journey. The premise of this blog is to share a scenario where you want to download your API Proxy (ex, a backup for your business) and then upload that. There are two services you need to complete this:

{{url}}/apiportal/api/1.0/Transport.svc

{{url}}/apiportal/api/1.0/Management.svc

The URL is provided in the security JSON you completed in the last section. With services that follow the OData standard, you can call the $metadata at the root to get the available entity sets in the service. Ex: ‘{{url}}/apiportal/api/1.0/Management.svc/$metadata’.

 

Download the API Proxy

In this first example, we want to download the API Proxy as a backup. In the image below, you can use the interface to export and import an API Proxy:

Integration Suite Web Services

Additionally, in the following, we need to use an OData call to do the same action as what the web interface does. SAP created an API call that does precisely that!

GET: {{url}}/apiportal/api/1.0/Transport.svc/APIProxies?name=Swagger_Petstore

Where ‘Swagger_Petstore’ is the name of your API Proxy. Hint: you can use the Management.srv to get the list of ‘APIProxies’ you can use. This request downloads as a ZIP file, very much the same as the web interface! Side note: if you run this in Postman, next to the ‘Send’ button is a little arrow down; click that to select ‘Send and Download’ to download the call into the file.

 

Uploading the API Proxy

In the last step, we downloaded the API Proxy as a ZIP from the entity set. Pretty cool, right? Now, we need to upload the same file.

POST: {{url}}/apiportal/api/1.0/Transport.svc/APIProxies?virtualhost={VirtualHost GUID ID}

The important thing to note here is that the Body of this request is the base64 string of the *.zip API Proxy. Several programming languages support the conversion to base64. Powershell has a call *.ToBase64String that will allow you to convert the ZIP file.

 

SAP API Catalog – Business Accelerator Hub

I have shown you a small subset of a specific scenario. There are a number of APIs available to connect within the SAP framework, whether it is API Management, Integration Suite, or more. Head to https://api.sap.com and look for the ‘APIs’ under the Explore Categories section. 

Remember earlier, we obtained our security information in a JSON file for your API Portal? You can use that same information to set up your environment to use the ‘Try Now’ feature in the Business Hub! To set one up, after you click on the ‘Try Now’ button, next to the request is the Environment button. Click it to add your environment, OR use the provided sandbox to give it a go. The SAP Sandbox limits some change operations, so POSTing the new API Proxy won’t work. Don’t worry, it will provide you with

Integration Suite Web Services

Head on out there today and explore! Happy hunting!

 

Visit our blog library here
View our LinkedIn here

Nick Bagalay is an experienced senior consultant focusing on ABAP. He has over 10 years of experience working with SAP systems and customers. Nick’s hobbies include camping, riding his motorcycle, and above all, spending time with his family.

Back To Top