Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Including API Dependencies Within Your API Definition

DZone's Guide to

Including API Dependencies Within Your API Definition

If you develop APIs, read on to learn about Pivio, a discovery specification for microservices which defines internal and external service dependencies.

· Integration Zone
Free Resource

Share, secure, distribute, control, and monetize your APIs with the platform built with performance, time-to-value, and growth in mind. Free 90-day trial of 3Scale by Red Hat

I was learning about Pivio, a discovery specification for microservices the other day, and found their focus on microservice dependency to be pretty interesting. API dependencies have been an area I have found myself increasingly thinking about, as well as tracking in my API research. I’m pretty close to publishing a project dedicated to understanding API and microservices dependencies, which would overlap with containers, serverless, and other aspects of the API lifecycle that are all about breaking down the monolith.

Each service definition using Pivio has a depends_on object, which allows for defining both internal and external service dependencies. Here is a snippet from a sample Pivio document to help articulate this interesting feature:

"service": {
  "depends_on": {
    "internal": [
      "print-service",
      "gateway-service"
    ],
    "external": [
      {
        "why": "Need to sync data with it.",
        "transport_protocol": "tcp",
        "target": "https://api.superdealz.me:443",
        "via": "proxy-service"
      },
      {
        "why": "Get the latest Dealz.",
        "transport_protocol": "tcp",
        "target": "mqtt://192.xxx.xxx.xxx:5028"
      }
    ]
  }

This is where you can start connecting the cords between all of your services, something that is applicable to any APIs, whether you’ve drunk the microservices kool-aid or not. I find it interesting that Pivio has internal and external. I’d love to see an OpenAPI linked off each of the services it depends on. I also am fascinated with the first question for external, why? What a great first question for any dependency–it should also be available for internal services as well. Every API provider should be inquiring why a dependency exist whenever possible, and having it quantified in this way just opens up more chances for this question to get asked.

Seeing dependencies quantified in Pivio makes me happy. It has been something I’ve wanted to reflect in APIs.json for some time now. Currently, I do not know of any way to quantify the relationship between APIs, and Pivio provides a glimpse at one possible way we might be able to map this world out. I have been learning more about Cytoscape, a network data integration, analysis, and visualization framework. Having a machine readable API dependencies definition would allow me to create a network visualization of any API or microservices discovery catalog. It wouldn’t take much work at all to map out API and microservice dependencies at the internal and external levels, further helping to quantify the platforms we operate.

Explore the core elements of owning an API strategy and best practices for effective API programs. Download the API Owner's Manual, brought to you by 3Scale by Red Hat

Topics:
integration ,api ,microservices

Published at DZone with permission of Kin Lane, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}