CLI for DataGraph API Source Management
Command | Description |
---|---|
Adds an API source |
|
Promotes an API source |
|
Updates an API source |
|
Scales API calls made to the unified schema |
|
Downloads the unified schema |
|
Deletes an API source |
|
Gets an API source |
|
Lists all API sources |
|
Returns information about DataGraph |
|
Validates an API source for the unified schema |
datagraph sources add
> datagraph sources add <g/a/v>
DataGraph supports only |
This command adds an API source, specified by <g/a/v>
, in which g
is the group ID, a
the asset ID, and v
the version ID of the API source. The group ID is optional. If you don’t specify a group ID, the command uses the current organization ID.
In addition to the default --help
, -f/--fields
, -o/--output
, and --verbose
options, this command accepts the following options:
Options | Description |
---|---|
|
Use if your API is public. |
|
Use if you authenticate to your API either by passing the basic authentication header or by passing a username and password.
|
|
Use if you authenticate to your API by passing OAuth 2.0
|
|
Use if you authenticate to your API by passing authorization headers.
|
|
Use if you authenticate to your API by passing custom header parameters and values.
|
|
Use if you authenticate to your API by passing query parameters and values.
|
|
Configures the URL for the backend API. |
|
Automatically discovers the URL of the backend API based on the instances running in the current environment. If more than one API is running, DataGraph uses the first URL. |
|
Specify a comma-separated list of certificate authority (CA) files to add to the API’s truststore, for example, |
|
Specify the filename of the client certificate to use for mutual transport layer security (mTLS), for example, |
|
Specify the filename of the private key to use for mTLS, for example |
|
Specify the password to decrypt an encrypted private key. |
|
Use to apply valid edits made in the extensions in the API specification and to ignore any edits that are invalid. |
All headers and query params defined in the command line, and all header and query param files, are appended. If there are repeated keys, the values provided in the command line takes precedence. |
Example Command
datagraph sources add 18dc11ee-4a09-4aae-9c6c-4371a87eafa8/product-api/1.0.0/ --url http://test.com
Example Output
{ "apiVersion": "v1", "assetId": "product-api", "createDate": "2022-05-20T18:05:41", "endpoint": "http://test.com", "environmentId": "<envID>", "groupId": "<groupID>", "name": "Product API", "organizationId": "<orgID>", "securityScheme": "NO_AUTH", "sourceId": "deca7be1-c299-4441-bc7b-dba733e3a11f", "updateDate": "2022-05-20T18:05:41", "version": "1.0.0", "origin": "CLI" }
datagraph sources promote
> datagraph sources promote <sourceId> <target-EnvID>
This command promotes an API source <sourceId>
to the target environment <targetEnv>
.
In addition to the default --help
, -f/--fields
, -o/--output
, and --verbose
options, this command accepts the following options:
Options | Description |
---|---|
|
Use if your API is public. |
|
Use if you authenticate to your API either by using the basic authentication header or by using a username and password.
|
|
Use if you authenticate to your API by passing OAuth 2.0
|
|
Use if you authenticate to your API by passing authorization headers.
|
|
Use if you authenticate to your API by passing custom header parameters and values.
|
|
Use if you authenticate to your API by passing query parameters and values.
|
|
Configures the URL for the backend API. |
|
Automatically discovers the URL of the backend API based on the instances running in the current environment. If more than one API is running, DataGraph uses the first URL. |
|
Specify a list of CA files to add to the API’s truststore. |
|
Specify the client certificate to use for mTLS. |
|
Specify the private key to use for mTLS. |
|
Specify the password to decrypt an encrypted private key. |
|
Deletes all CA certificates. |
|
Deletes the client certificate, private key, and private key password information. |
All headers and query params defined in the command line, and all header and query param files, are appended. If there are repeated keys, the values provided in the command line takes precedence. |
Example Command
In this example, the environmentId
is changed after running the promote
command.
datagraph sources promote d1d27987-939a-4b41-b3ef-411568ee5bdd e7e8da65-9cf1-569e-c9d2-brd2r0rc7rd6 --auth-none
Example Output
{ "apiVersion": "1.0", "assetId": "order-e2e", "createDate": "2022-05-27T18:56:03", "endpoint": "http://test.com", "environmentId": "e7e8da65-9cf1-569e-c9d2-brd2r0rc7rd6", "groupId": "<groupID>", "name": "Order E2E", "organizationId": "<orgID>", "securityScheme": "NO_AUTH", "sourceId": "1ff021b3-9296-43fd-9d64-2f9027c25740", "updateDate": "2022-05-27T18:56:03", "version": "1.0.0", "origin": "CLI" }
datagraph sources update
> datagraph sources update <sourceId>
DataGraph supports only |
This command updates the version of an API source <sourceId>
.
In addition to the default --help
, -f/--fields
, -o/--output
, and --verbose
options, this command accepts the following options:
Options | Description |
---|---|
|
Use if your API is public. |
|
Use if you authenticate to your API by passing either the basic authentication header or both a username and password.
|
|
Use if you authenticate to your API by passing OAuth 2.0
|
|
Use if you authenticate to your API by passing authorization headers.
|
|
Use if you authenticate to your API by passing custom header parameters and values.
|
|
Use if you authenticate to your API by passing query parameters and values.
|
|
Configures the URL for the backend API. |
|
Automatically discovers the URL of the backend API based on the instances running in the current environment. If more than one API is running, DataGraph uses the first URL. |
|
Specify a list of CA files to add to the API’s truststore. |
|
Specify the client certificate to use for mTLS. |
|
Specify the private key to use for mTLS. |
|
Specify the password to decrypt an encrypted private key. |
|
Deletes all CA certificates. |
|
Deletes the client certificate, private key, and private key password information. |
|
Keeps edits that are present in the current version of the API source instead of extracting those edits from the API specification. |
|
Change the origin of the API source to the CLI. Ff the origin of the API source is the DataGraph UI, use this option to override the UI edits with the edits in the API specification. |
|
Use to apply valid edits made in the extensions in the API specification and to ignore any edits that are invalid. |
All headers and query params defined in the command line, and all header and query param files, are appended. If there are repeated keys, the values provided in the command line takes precedence. |
Example Command
The following command updates the URL of the source API and changes its authentication from auth-none
to auth-basic
, adding a client ID and secret.
> datagraph sources update b6cb82a6-51dc-4968-861a-aa04447c3442 --url http://test2.com --version 1.0.0 --auth-basic --credentials client-test:client-secret
Example Output
{ "apiVersion": "v1", "assetId": "product-api", "createDate": "2022-05-20T18:56:57Z", "endpoint": "http://test2.com", "environmentId": "<envID>", "groupId": "<groupID>", "name": "Product API", "organizationId": "<orgID>", "securityScheme": "BASIC", "sourceId": "b6cb82a6-51dc-4968-861a-aa04447c3442", "updateDate": "2022-05-27T18:31:39", "version": "1.0.0", "origin": "CLI" }
datagraph scale
> datagraph scale <concurrent-api-calls>
This command enables you to configure the number of concurrent API calls permitted for a unified schema. Increasing or decreasing API calls enables you to process higher workloads and optimize your consumption when needed.
This command takes the default --help
, -f/--fields
, -o/--output
, and --verbose
options.
datagraph schema-download
> datagraph schema-download
This command downloads the unified schema for the current environment.
This command takes the default --help
, -f/--fields
, -o/--output
, and --verbose
options.
Example Output
directive @key(fields: String) on OBJECT "An Item" type Item { itemId: Int! "A Product" product: OrderProduct! quantity: Int! } "An Order" type Order { items: [Item!]! orderId: String! customerId: String! } "A Product" type OrderProduct { productId: String! name: String! } type Query { orders(ordersCount: Int): [Order!] ordersByOrderId(orderId: String!): Order ordersProductsByOrderId(productsCounts: Int, orderId: String!): [OrderProduct!] }
datagraph sources delete
> datagraph sources delete <sourceId>
This command deletes the specified API source.
This command takes the default --help
, -f/--fields
, -o/--output
, and --verbose
options.
datagraph sources get
> datagraph sources get <sourceId>
This command gets the specified API source.
This command takes the default --help
, -f/--fields
, -o/--output
, and --verbose
options.
Example Output
{ "apiVersion": "1.0", "assetId": "order-e2e", "createDate": "2022-05-20T16:49:00Z", "hasKeystore": false, "endpoint": "http://test.com", "environmentId": "<envID>", "groupId": "<groupID>", "name": "Order E2E", "organizationId": "<orgID>", "hasTruststore": false, "securityScheme": "NO_AUTH", "sourceId": "d1d27987-939a-4b41-b3ef-411568ee5bdd", "updateDate": "2022-05-20T16:49:00Z", "version": "1.0.0", "origin": "CLI" }
datagraph sources list
> datagraph sources list
This command lists all API sources for the current environment.
This command takes the default --help
, -f/--fields
, -o/--output
, and --verbose
options.
Example Output
{ "apiVersion": "1.0", "assetId": "order-e2e", "createDate": "2022-05-20T16:49:00.000Z", "endpoint": "http://test.com", "environmentId": "<envID>", "groupId": "<groupID>", "name": "Order E2E", "organizationId": "<orgID>", "securityScheme": "NO_AUTH", "sourceId": "d1d27987-939a-4b41-b3ef-411568ee5bdd", "updateDate": "2022-05-20T16:49:00.000Z", "version": "1.0.0", "origin": "CLI" }, { "apiVersion": "v1", "assetId": "product-api", "createDate": "2022-05-20T18:05:41.000Z", "endpoint": "http://test.com", "environmentId": "<envID>", "groupId": "<groupID>", "name": "Product API", "organizationId": "<orgID>", "securityScheme": "NO_AUTH", "sourceId": "deca7be1-c299-4441-bc7b-dba733e3a11f", "updateDate": "2022-05-20T18:05:41.000Z", "version": "1.0.0", "origin": "CLI" }
datagraph describe
> datagraph describe
This command returns the following information about DataGraph:
-
endpoint
: Displays the GraphQL endpoint that accepts requests. -
deploymentError
: If a DataGraph deployment fails, this field describes the error; otherwise, it’s empty. -
deploymentStatus
: Shows whether DataGraph is deploying, running, or has errors. -
logLevels
: Displays a list of the configured log levels. -
envStatus
: Displays the status of the current environment. -
dlbEndpoint
: Displays the load balancer endpoint.
This command takes the default --help
, -f/--fields
, -o/--output
, and --verbose
options.
datagraph validate
> datagraph validate asset <g/a/v>
This command validates if it’s possible to add an API source to the unified schema. To do so, the command:
-
Translates the API source into a GraphQL schema.
-
Validates any API extensions applied in the API specification.
-
Runs a conflict check against the unified schema.
If any of these steps generates a conflict or error, the command returns the result. If it finds no conflicts or errors, it returns a success message.
The API source to validate is specified by <g/a/v>
, in which g
is the group ID, a
the asset ID, and v
the version ID of the API source. The group ID is optional. If you don’t specify a group ID, the command uses the current organization ID.
This command takes the default --help
, -f/--fields
, -o/--output
, and --verbose
options.