-
Notifications
You must be signed in to change notification settings - Fork 702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lack of documentation on http+json requests example #5158
Comments
Thank you for opening your first issue here! 🛠 |
Hey @secureness, fancy seeing you back here! Hope you're ready to dive into more Flyte adventures. 🚀 Based on your request, it seems you're looking to use HTTP+JSON requests as an alternative to command-line operations in Flyte. While the Flyte documentation may not provide explicit examples of this, it's certainly possible to achieve this by interacting with the Flyte Admin API. The Flyte Admin API provides a comprehensive set of endpoints for managing workflows, tasks, projects, and their associated data and attributes. You can use these endpoints to perform operations such as running a workflow, listing workflows, and more. Here's a simplified example of how you might structure a Go code to make a generic HTTP+JSON request to run a workflow: package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
// Example JSON payload
workflowData := map[string]interface{}{
"project": "admintests",
"domain": "development",
"name": "example_workflow",
// Add other necessary fields here
}
jsonData, err := json.Marshal(workflowData)
if err != nil {
panic(err)
}
// Replace with the actual URL of the Flyte Admin API endpoint for running a workflow
url := "http://flyteadmin.example.com/api/v1/workflows/run"
request, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
if err != nil {
panic(err)
}
// Set headers
request.Header.Set("Content-Type", "application/json")
// Send the request
client := &http.Client{}
response, err := client.Do(request)
if err != nil {
panic(err)
}
defer response.Body.Close()
// Read and process the response
body, err := ioutil.ReadAll(response.Body)
if err != nil {
panic(err)
}
fmt.Println("Response:", string(body))
// Process the response as needed
} This example demonstrates how to construct and send a JSON payload to a hypothetical Flyte Admin API endpoint for running a workflow. You'll need to adjust the For more details on the specific API endpoints available in the Flyte Admin API for running workflows and other operations, you can refer to the FlyteIDL files in the Flyte repository:
These files provide a comprehensive list of the available API endpoints and their associated operations. I hope this helps! If you have any further questions or need more specific examples, please let me know. Sources
|
@secureness We expose an open API definition endpoint ( https://docs.flyte.org/en/latest/reference/swagger.html#reference-swagger |
@pingsutw Thank you! |
Description
Hi, I really need to work directly with HTTP requests, I read that you have grpc-gateway, but there are no examples in the documentation of how we can use HTTP requests instead of a command like:
Are you sure this issue hasn't been raised already?
Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: