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
- Go
- Java
- Curl
import weaviate
client = weaviate.Client("http://localhost:8080")
open_id_configuration = client.get_open_id_configuration()
print(open_id_configuration)
const weaviate = require('weaviate-client');
const client = weaviate.client({
scheme: 'http',
host: 'localhost:8080',
});
client.misc
.openidConfigurationGetter()
.do()
.then(res => {
console.log(res);
})
.catch(err => {
console.error(err)
});
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
- Go
- Java
- Curl
import weaviate
client = weaviate.Client("http://localhost:8080")
is_live = client.is_live()
print(is_live)
const weaviate = require('weaviate-client');
const client = weaviate.client({
scheme: 'http',
host: 'localhost:8080',
});
client.misc
.liveChecker()
.do()
.then(res => {
console.log(res);
})
.catch(err => {
console.error(err)
});
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
- 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
const weaviate = require('weaviate-client');
const client = weaviate.client({
scheme: 'http',
host: 'localhost:8080',
});
client.misc
.readyChecker()
.do()
.then(res => {
console.log(res);
})
.catch(err => {
console.error(err)
});
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.
More Resourcesโ
If you can't find the answer to your question here, please look at the:
- Frequently Asked Questions. Or,
- Knowledge base of old issues. Or,
- For questions: Stackoverflow. Or,
- For more involved discussion: Weaviate Community Forum. Or,
- We also have a Slack channel.