How Big or Small Is an API?

ICYMI: I am working to build out the API Gallery for Streamdata.io, profiling a wide variety of APIs for inclusion in the directory, adding to the wealth of APIs that could be streamed using the service. As I work to build the index, I’m faced with the timeless question, what is an API? Not technically what an API does, but what is an API in the context of helping people discover the API they are looking for. Is Twitter an API, or is the Twitter search/tweets path of an API? My answer to this question always distills down to a specific API path, or as some call it an API endpoint. Targeting a specific implementation, use case, or value generated by a single API provider.

Like most things in the API sector, words are used interchangeably and depending on how much experience you have in the business, you will have much finer grained definitions about what something is, or isn’t. When I’m talking to the average business user, the Twitter API is the largest possible scope–the entire thing. In the context of API discovery, and helping someone find an API to stream or to solve a specific problem in their world, I’m going to resort to a very precise definition–in this case, it is the specific Twitter API path that will be needed. Depending on my audience, I will zoom out, or zoom in on what constitutes a unit of API. The only consistency I’m looking to deliver is regarding helping people understand, and find what they looking for–I’m not worried about always using the same scope in my definition of what an API is. https://goo.gl/eTErpr #DataIntegration #ML

SAP S/4HANA Cloud SDK: Version 1.8.0 is Available

The new version of the SAP S/4HANA Cloud SDK Java libraries is available since today. You can update your dependencies to version 1.8.0 and consume the new version from Maven Central.
In this blog post, we will walk you through the highlights of these releases. For a complete overview, visit our release notes for the Java libraries. The release notes also include the change log of all our releases so far.
At the end of the article, you will find a set of instructions on how to update to the new version.

Java Libraries: Release Highlights

Note: If you are using the SAP S/4HANA Cloud SDK in the Neo environment of SAP Cloud Platform, please note that there is a bug in the SDK that affects multi-tenant applications on Neo. We recommend NOT to update to version 1.8.0 in case of a multi-tenant application on Neo. Instead, wait for the next release of the SAP S/4HANA Cloud SDK, in which we plan to fix this bug. You can safely proceed to update the SDK version in Cloud Foundry applications.

As part of the SAP S/4HANA Cloud SDK, we also provide integration to popular third party frameworks on SAP Cloud Platform, for example Togglz or EclipseLink. Another example is Apache CXF; an open-source framework for developing services. With this version, we have extracted the JAX-RS specific functionality of the Apache CXF integration module into a seperate module com.sap.cloud.s4hana.frameworks:jaxrs to make it easier to leverage the corresponding functionality such as JSON message (de)serialization and error handling in applications that do not use Apache CXF.

The Javadoc of the SAP Cloud Platform abstractions (classes in packages com.sap.cloud.sdk.cloudplatform.*) has been improved to make it easier to use the corresponding functionality of the SAP S/4HANA Cloud SDK, which provides simple and transparent access to Cloud Platform features such as connectivity, security, tenants or audit logging, on both Cloud Foundry and Neo.

We have improved the contracts of methods for handling tenant, user and secret store by introducing more specific exceptions.

We have also changed names and packages of several classes – please take a close look at the compatibility notes for the full list of changes.

On some developer machines, deploying the app on the local TomEE server based on the scp-cf-tomee archetype may have failed previously with exceptions such as java.lang.NoSuchMethodError: org.apache.tomcat.util.ExceptionUtils.preload()V. We have resolved this issue by removing the tomcat-catalina lib from the TomEE Maven plugin configuration in the application/pom.xml file as generated by scp-cf-tomee archetype. Newly generated project will no longer produce this error. If you have previously generated a project using that archetype and experience the same issue, manually remove the following lines at the end of application/pom.xml: org.apache.tomcat:tomcat-catalina:7.0.82

We have also fixed several further issues as explained in the full release notes.

How to Update: Java Libraries

Note: As mentioned above, we recommend NOT to update the SDK for a multi-tenant application on Neo.

To update the version of the SAP S/4HANA Cloud SDK Java libraries used in an existing project on Cloud Foundry, proceed as follows:

* Open the pom.xml file in the root folder of your project.
* Locate the dependency management section and therein the sdk-bom dependency.
* Update the version of that dependency to 1.8.0.

With this, you are already done thanks to the “bill of material” (BOM) approach. Your dependency should look like this: com.sap.cloud.s4hana sdk-bom 1.8.0 pom import

You can now recompile your project (be aware of the compatibility notes, though) and leverage the new features of the SAP S/4HANA Cloud SDK in version 1.8.0.

Of course, you can also generate a new project that uses version 1.8.0 from the start by running the Maven archetypes for Cloud Foundry with -DarchetypeVersion=1.8.0 (or RELEASE). http://bit.ly/2BNYdsy #SAP #SAPCloud #AI

ABAP and Swagger/OpenAPI

Swagger

Swagger is a set of tools for creating, generating, documenting, and testing RESTful services.
It is centered around a specification file(https://swagger.io/specification/), which contains the description of the REST services, much like a SOAP WSDL or OData metadata file.

There are many powerful tools in the Swagger family, which all are open source:

* Editor
* UI
* Inspector

These tools are free and works in the browser. SAP also use Swagger as part of API management.

ABAP

A while ago I started building a tool for integrating ABAP and Swagger using an inside-out approach.

Lets jump right into it and see how it works, suppose I want to expose the methods of the following class as REST services: CLASS zcl_todo DEFINITION PUBLIC CREATE PUBLIC. PUBLIC SECTION. METHODS create IMPORTING is_data TYPE ztodo_data RETURNING VALUE(rs_key) TYPE ztodo_key . METHODS delete IMPORTING is_key TYPE ztodo_key . METHODS list RETURNING VALUE(rt_list) TYPE ztodo_tt . METHODS update IMPORTING iv_guid TYPE ztodo_key-guid is_data TYPE ztodo_data . ENDCLASS. CLASS ZCL_TODO IMPLEMENTATION. METHOD create. DATA: ls_todo TYPE ztodo. TRY. rs_key-guid = cl_system_uuid=>if_system_uuid_static~create_uuid_c22( ). CATCH cx_uuid_error. ASSERT 0 = 1. ENDTRY. MOVE-CORRESPONDING rs_key TO ls_todo. MOVE-CORRESPONDING is_data TO ls_todo. INSERT ztodo FROM ls_todo. ASSERT sy-subrc = 0. ENDMETHOD. METHOD delete. DELETE FROM ztodo WHERE guid = is_key-guid. ASSERT sy-subrc = 0. ENDMETHOD. METHOD list. SELECT * FROM ztodo INTO TABLE rt_list. “#EC CI_NOWHERE ENDMETHOD. METHOD update. DATA: ls_todo TYPE ztodo. ls_todo-guid = iv_guid. MOVE-CORRESPONDING is_data TO ls_todo. UPDATE ztodo FROM ls_todo. ASSERT sy-subrc = 0. ENDMETHOD. ENDCLASS.

Interface ZIF_SWAG_HANDLER must be implemented, and metadata added for the methods to be exposed, METHOD zif_swag_handler~meta. FIELD-SYMBOLS: LIKE LINE OF rt_meta. APPEND INITIAL LINE TO rt_meta ASSIGNING . -summary = ‘List’(001). -url-regex = ’/list$’. -method = zcl_swag=>c_method-get. -handler = ‘LIST’. APPEND INITIAL LINE TO rt_meta ASSIGNING . -summary = ‘Create’(002). -url-regex = ’/create$’. -method = zcl_swag=>c_method-post. -handler = ‘CREATE’. APPEND INITIAL LINE TO rt_meta ASSIGNING . -summary = ‘Delete’(003). -url-regex = ’/delete$’. -method = zcl_swag=>c_method-post. -handler = ‘DELETE’. APPEND INITIAL LINE TO rt_meta ASSIGNING . -summary = ‘Update’(004). -url-regex = ’/update/(w+)$’. APPEND ‘IV_GUID’ TO -url-group_names. -method = zcl_swag=>c_method-post. -handler = ‘UPDATE’. ENDMETHOD.

Add the handler to a custom SICF node, and thats about it! ABAP-Swagger will automatically generate a spec from the method definitions, and it is possible to use the Swagger UI to test the services. ABAP-Swagger is open source and works from 702 and up.

The full example can be found at https://github.com/larshp/todo_logic

Find more Open Source ABAP projects on dotabap.org

ABAP is like the sun, it will keep shining for a million years http://bit.ly/2F3JR9n #SAP #SAPCloud #AI