REST - /v1/.well-known
OpenID Configuration
The RESTful API discovery gives information if OpenID Connect (OIDC) authentication is enabled. The endpoint redirects to the token issued if one is configured.
Usage
The discovery endpoint accepts a GET
request:
GET /v1/.well-known/openid-configuration
And it returns the following fields:
href
: The reference to the client.cliendID
: The ID of the client.
If no OIDC provider is present, a 404
code will be returned.
Example
The following command:
- Python
- JavaScript/TypeScript
- Go
- Java
- Curl
import weaviate
client = weaviate.Client("http://localhost:8080")
open_id_configuration = client.get_open_id_configuration()
print(open_id_configuration)
import weaviate from 'weaviate-ts-client';
const client = weaviate.client({
scheme: 'http',
host: 'localhost:8080',
});
const response = await client.misc
.openidConfigurationGetter()
.do();
console.log(JSON.stringify(response, null, 2));
package main
import (
"context"
"fmt"
"github.com/weaviate/weaviate-go-client/v4/weaviate"
)
func main() {
cfg := weaviate.Config{
Host: "localhost:8080",
Scheme: "http",
}
client, err := weaviate.NewClient(cfg)
if err != nil {
panic(err)
}
openIDConfig, err := client.Misc().OpenIDConfigurationGetter().Do(context.Background())
if err != nil {
panic(err)
}
fmt.Printf("%v", openIDConfig)
}
package io.weaviate;
import io.weaviate.client.Config;
import io.weaviate.client.WeaviateClient;
import io.weaviate.client.base.Result;
import io.weaviate.client.v1.misc.model.OpenIDConfiguration;
public class App {
public static void main(String[] args) {
Config config = new Config("http", "localhost:8080");
WeaviateClient client = new WeaviateClient(config);
Result<OpenIDConfiguration> result = client.misc().openIDConfigGetter().run();
if (result.hasErrors()) {
System.out.println(result.getError());
return;
}
System.out.println(result.getResult());
}
}
curl http://localhost:8080/v1/.well-known/openid-configuration
returns:
{
"href": "http://my-token-issuer/auth/realms/my-weaviate-usecase",
"cliendID": "my-weaviate-client"
}
Liveness
Live determines whether the application is alive. It can be used for Kubernetes liveness probe.
Usage
The discovery endpoint accepts a GET
request:
GET /v1/.well-known/live
And it returns 200 if the application is able to respond to HTTP requests.
Example
If the following command:
- Python
- JavaScript/TypeScript
- Go
- Java
- Curl
import weaviate
client = weaviate.Client("http://localhost:8080")
is_live = client.is_live()
print(is_live)
import weaviate from 'weaviate-ts-client';
const client = weaviate.client({
scheme: 'http',
host: 'localhost:8080',
});
const response = await client.misc
.liveChecker()
.do();
console.log(response);
package main
import (
"context"
"fmt"
"github.com/weaviate/weaviate-go-client/v4/weaviate"
)
func main() {
cfg := weaviate.Config{
Host: "localhost:8080",
Scheme: "http",
}
client, err := weaviate.NewClient(cfg)
if err != nil {
panic(err)
}
isLive, err := client.Misc().LiveChecker().Do(context.Background())
if err != nil {
panic(err)
}
fmt.Printf("%v", isLive)
}
package io.weaviate;
import io.weaviate.client.Config;
import io.weaviate.client.WeaviateClient;
import io.weaviate.client.base.Result;
public class App {
public static void main(String[] args) {
Config config = new Config("http", "localhost:8080");
WeaviateClient client = new WeaviateClient(config);
Result<Boolean> result = client.misc().liveChecker().run();
if (result.hasErrors()) {
System.out.println(result.getError());
return;
}
System.out.println(result.getResult());
}
}
curl http://localhost:8080/v1/.well-known/live
returns nothing (a 200 response), you know the application is able to respond to HTTP requests.
Readiness
Live determines whether the application is ready to receive traffic. It can be used for Kubernetes readiness probe.
Usage
The discovery endpoint accepts a GET
request:
GET /v1/.well-known/ready
And it returns 200 if the application is able to respond to HTTP requests, and 503 if the application is currently not able to serve traffic. If other horizontal replicas of Weaviate are available and they are capable of receiving traffic, all traffic should be redirected there instead.
Example
If the following command:
- Python
- JavaScript/TypeScript
- Go
- Java
- Curl
import weaviate
client = weaviate.Client("http://localhost:8080")
is_ready = client.is_ready()
print(is_ready) # returns True if Weaviate is ready
import weaviate from 'weaviate-ts-client';
const client = weaviate.client({
scheme: 'http',
host: 'localhost:8080',
});
const response = await client.misc
.readyChecker()
.do();
console.log(response);
package main
import (
"context"
"fmt"
"github.com/weaviate/weaviate-go-client/v4/weaviate"
)
func main() {
cfg := weaviate.Config{
Host: "localhost:8080",
Scheme: "http",
}
client, err := weaviate.NewClient(cfg)
if err != nil {
panic(err)
}
isReady, err := client.Misc().ReadyChecker().Do(context.Background())
if err != nil {
panic(err)
}
fmt.Printf("%v", isReady)
}
package io.weaviate;
import io.weaviate.client.Config;
import io.weaviate.client.WeaviateClient;
import io.weaviate.client.base.Result;
public class App {
public static void main(String[] args) {
Config config = new Config("http", "localhost:8080");
WeaviateClient client = new WeaviateClient(config);
Result<Boolean> result = client.misc().readyChecker().run();
if (result.hasErrors()) {
System.out.println(result.getError());
return;
}
System.out.println(result.getResult());
}
}
curl http://localhost:8080/v1/.well-known/ready
returns nothing (a 200 response), you know the application is able to respond to HTTP requests.