Skip to content
Serban Petrescu edited this page Jan 27, 2018 · 3 revisions

sapim

SAP API Manager Tools

A suite of tools for deploying and building SAP API Manager API proxies and key-value maps.

The library introduces two new concepts to the real of the SAP API Manager artefacts:

  • Manifests
  • Templates

Manifests

Each API proxy can have an attached manifest. This is a file which stores some metadata related to the proxy itself. The manifest can either be a JSON or a YAML file adhering to this schema. It contains:

  • The name of the API Proxy.
  • The location where the proxy source files are located.
  • A flag indicating that the source files should be treated as a template.
  • A set of placeholder values to be used to "instantiate" the template (only relevant if the above flag is set).
  • A set of key-value maps that will be created when the proxy is deployed.

Example manifest.yaml:

proxy:
  name: my-test-proxy
  path: ./my-test-proxy
  templated: true
  placeholders:
    some-placeholder-name: My string value here
    another-placeholder: Another string value here
maps:
  my-first-map-name:
    some-string-key: Some string value
    some-object-key:
      first-property: Some string
      some-other-property: 1
  my-second-map-name:
    some-key-name: Some value

Templates

Templates consist of regular API proxy source files (XML, JS, PY files) which may have placeholders. These placeholders can be used inside these files with the following notation: {{placeholder-name}}. When deploying or applying the template, the placeholder values are replaced with the actual values (from the manifest or from the arguments passed).

For example, an XML file containing:

<APIProxy>
    <name>{{name}}</name>
    <title>{{name}}</title>
</APIProxy>

And with the placeholder definition name: my-api-proxy inside the manifest, will result in the following file:

<APIProxy>
    <name>my-api-proxy</name>
    <title>my-api-proxy</title>
</APIProxy>

Reverse engineering of templates can be done using the extract methods / commands, but is slightly unreliable: if there are multiple placeholders with the same value, the first one will trump all other placeholders. Also, placeholders having very generic values (e.g. "true") might be inferred in unexpected places.

Clone this wiki locally