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 := weaviate.New(cfg)
openIDConfig, err := client.Misc().OpenIDConfigurationGetter().Do(context.Background())
if err != nil {
panic(err)
}
fmt.Printf("%v", openIDConfig)
}
package technology.semi.weaviate;
import technology.semi.weaviate.client.Config;
import technology.semi.weaviate.client.WeaviateClient;
import technology.semi.weaviate.client.base.Result;
import technology.semi.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 := weaviate.New(cfg)
isLive, err := client.Misc().LiveChecker().Do(context.Background())
if err != nil {
panic(err)
}
fmt.Printf("%v", isLive)
}
package technology.semi.weaviate;
import technology.semi.weaviate.client.Config;
import technology.semi.weaviate.client.WeaviateClient;
import technology.semi.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 := weaviate.New(cfg)
isReady, err := client.Misc().ReadyChecker().Do(context.Background())
if err != nil {
panic(err)
}
fmt.Printf("%v", isReady)
}
package technology.semi.weaviate;
import technology.semi.weaviate.client.Config;
import technology.semi.weaviate.client.WeaviateClient;
import technology.semi.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 issues: Github. Or,
- Ask your question in the Slack channel: Slack.