Getting Started With Prodvana APIs
Once you have an API token, you are ready to start interacting with Prodvana APIs.
OpenAPI
Authenticating with Prodvana's OpenAPI endpoints requires setting your API Token as a bearer token. For example, to fetch all Applications:
$ curl -H "Authorization: Bearer <API Token>" \
https://openapi.<org_slug>.<<domain>>/v1/applications
{"applications":[<...>]}
See the Prodvana OpenAPI Reference docs for details about available API endpoints.
Python
Install the Prodvana python package:
pip install prodvana
The package contains a helper to instantiate a gRPC connection:
import argparse
from prodvana.client import make_channel, Client
from prodvana.proto.prodvana.application.application_manager_pb2 import (
ListApplicationsReq,
)
def main() -> None:
ap = argparse.ArgumentParser()
ap.add_argument(
"--api-token", help="Prodvana API token. if not passed, defaults to PVN_TOKEN."
)
ap.add_argument(
"--org",
required=True,
help="Organization slug for your instance of Prodvana. This is the part of your URL before .prodvana.io.",
)
args = ap.parse_args()
with make_channel(org=args.org, api_token=args.api_token) as channel:
client = Client(channel=channel)
resp = client.application_manager.ListApplications(ListApplicationsReq())
for app in resp.applications:
print(app.meta.name)
if __name__ == "__main__":
main()
Updated about 1 year ago