### Go SDK Example Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agents/copytoenvironment.md Go example using net/http to POST to /agents/environment-copies with the required payload and headers. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api/agents/environment-copies" payload := strings.NewReader("{\n \"orgSlug\": \"string\",\n \"agentIds\": [\n \"string\"\n ],\n \"sourceEnvironmentId\": \"string\",\n \"targetEnvironmentId\": \"string\",\n \"promptName\": \"string\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-API-Key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Java SDK Example Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agents/copytoenvironment.md Java example using Unirest to POST to /agents/environment-copies with the required headers and body. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api/agents/environment-copies") .header("X-API-Key", "") .header("Content-Type", "application/json") .body("{\n \"orgSlug\": \"string\",\n \"agentIds\": [\n \"string\"\n ],\n \"sourceEnvironmentId\": \"string\",\n \"targetEnvironmentId\": \"string\",\n \"promptName\": \"string\"\n}") .asString(); ``` -------------------------------- ### Swift SDK Example Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agents/copytoenvironment.md Swift example using URLSession to POST to /agents/environment-copies with the required headers and parameters. ```swift import Foundation let headers = [ "X-API-Key": "", "Content-Type": "application/json" ] let parameters = [ "orgSlug": "string", "agentIds": ["string"], "sourceEnvironmentId": "string", "targetEnvironmentId": "string", "promptName": "string" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api/agents/environment-copies")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### PHP SDK Example Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agents/copytoenvironment.md PHP example using GuzzleHttp to POST to /agents/environment-copies with the required body and headers. ```php request('POST', 'https://api/agents/environment-copies', [ 'body' => '{ "orgSlug": "string", "agentIds": [ "string" ], "sourceEnvironmentId": "string", "targetEnvironmentId": "string", "promptName": "string" }', 'headers' => [ 'Content-Type' => 'application/json', 'X-API-Key' => '', ], ]); echo $response->getBody(); ``` -------------------------------- ### Ruby SDK Example Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agents/copytoenvironment.md Ruby example using Net::HTTP to POST to /agents/environment-copies with the required payload and headers. ```ruby require 'uri' require 'net/http' url = URI("https://api/agents/environment-copies") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["X-API-Key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"orgSlug\": \"string\",\n \"agentIds\": [\n \"string\"\n ],\n \"sourceEnvironmentId\": \"string\",\n \"targetEnvironmentId\": \"string\",\n \"promptName\": \"string\"\n}" response = http.request(request) puts response.read_body ``` -------------------------------- ### Python SDK Example Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agents/copytoenvironment.md Python example using requests to POST to /agents/environment-copies with the required payload and headers. ```python import requests url = "https://api/agents/environment-copies" payload = { "orgSlug": "string", "agentIds": ["string"], "sourceEnvironmentId": "string", "targetEnvironmentId": "string", "promptName": "string" } headers = { "X-API-Key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` -------------------------------- ### JavaScript SDK Example Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agents/copytoenvironment.md JavaScript example using fetch to POST to /agents/environment-copies with the required headers and body. ```javascript const url = 'https://api/agents/environment-copies'; const options = { method: 'POST', headers: {'X-API-Key': '', 'Content-Type': 'application/json'}, body: '{"orgSlug":"string","agentIds":["string"],"sourceEnvironmentId":"string","targetEnvironmentId":"string","promptName":"string"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Python SDK Example Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/governance/generatepolicyprompt.md Python example using requests to POST to the generate-prompt endpoint with X-API-Key header. ```python import requests url = "https://api/governance/policies/generate-prompt" payload = { "orgSlug": "string", "instructions": "string" } headers = { "X-API-Key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` -------------------------------- ### Create Policy Go SDK Example Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/governance/createpolicy.md Go example using net/http to POST to /governance/policies with X-API-Key header. Prints the response and body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api/governance/policies" payload := strings.NewReader("{\n \"orgSlug\": \"string\",\n \"name\": \"string\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-API-Key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Quickstart: two agents with local relay Source: https://docs.ellaworks.ai/agx.md Install the CLI, start a local relay, create two identities, authorize B to call A, and run A as an agent. Then from a new shell, B sends a request and a message, and collects A's reply. Authorization is default-deny; without the allow line, the request gets no reply. ```bash npm install -g @nostr-agx/cli # terminal 1: a local development relay agx relay # terminal 2: two identities, then run A as an agent agx identity new --profile a agx identity new --profile b B=$(agx identity show --profile b --json | jq -r .npub) agx identity allow "$B" --profile a # authorization is default-deny agx serve --profile a # terminal 3: B calls A (a new shell, so read A's npub here) A=$(agx identity show --profile a --json | jq -r .npub) agx request "$A" invoice.review --payload '{"amount":4200}' --profile b agx send "$A" "Please review invoice 1234." --profile b --subject "Invoice 1234" agx serve --profile b --once --no-reply # collect A's reply to the message ``` -------------------------------- ### Quickstart: two agents, no server (CLI commands) Source: https://docs.ellaworks.ai/agx Commands to install the CLI, start a local relay, create two identities, authorize one to the other, serve as agent A, then from a new shell send a request and message to A and collect the reply. Without the allow line, the request gets no reply and agent A prints the reason. Without --handler, agx serve answers invoice.review with a built-in stand-in, so the result is canned. ```bash npm install -g @nostr-agx/cli # terminal 1: a local development relay agx relay # terminal 2: two identities, then run A as an agent agx identity new --profile a agx identity new --profile b B=$(agx identity show --profile b --json | jq -r .npub) agx identity allow "$B" --profile a # authorization is default-deny agx serve --profile a # terminal 3: B calls A (a new shell, so read A's npub here) A=$(agx identity show --profile a --json | jq -r .npub) agx request "$A" invoice.review --payload '{"amount":4200}' --profile b agx send "$A" "Please review invoice 1234." --profile b --subject "Invoice 1234" agx serve --profile b --once --no-reply # collect A's reply to the message ``` -------------------------------- ### C# SDK example for GET /api/elladex/agents/{address} Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/elladex/getagent.md Uses RestSharp to send a GET request and execute it. ```csharp using RestSharp; var client = new RestClient("https://api/elladex/agents/address"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Go SDK Example for Update Deployment Tool Refs Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agents/updatedeploymenttoolrefs.md Go example using net/http to send PATCH request with X-API-Key header. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api/agents/stableKey/tool-refs" payload := strings.NewReader("{\n \"orgSlug\": \"string\",\n \"promptName\": \"string\",\n \"toolRefs\": [\n \"string\"\n ]\n}") req, _ := http.NewRequest("PATCH", url, payload) req.Header.Add("X-API-Key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Create Environment SDK Code (Go) Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/environments/create.md Go example using net/http to POST to /environments with X-API-Key header. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api/environments" payload := strings.NewReader("{\n \"orgSlug\": \"string\",\n \"name\": \"string\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-API-Key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Swift SDK example for GET /api/elladex/agents/{address} Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/elladex/getagent.md Uses URLSession to send a GET request and prints the response or error. ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api/elladex/agents/address")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### PHP SDK example for GET /api/elladex/agents/{address} Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/elladex/getagent.md Uses GuzzleHttp to send a GET request and echoes the response body. ```php request('GET', 'https://api/elladex/agents/address'); echo $response->getBody(); ``` -------------------------------- ### Create Task SDK Example in Go Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/teams/createtask.md Go example using net/http to POST to the Create Task endpoint. Reads the response body and prints the response. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api/teams/teamId/tasks" payload := strings.NewReader("{\n \"orgSlug\": \"string\",\n \"title\": \"string\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-API-Key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Go SDK example for create key challenge Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agent-index/agent-index-create-key-challenge.md Go example using net/http to POST to /agent-index/key-challenges with X-API-Key header and JSON payload. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api/agent-index/key-challenges" payload := strings.NewReader("{\n \"orgSlug\": \"string\",\n \"pubkey\": \"string\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-API-Key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Java SDK example for GET /api/elladex/agents/{address} Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/elladex/getagent.md Uses Unirest to send a GET request and returns the response as a string. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api/elladex/agents/address") .asString(); ``` -------------------------------- ### Ruby SDK example for GET /api/elladex/agents/{address} Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/elladex/getagent.md Uses net/http with SSL to send a GET request and prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api/elladex/agents/address") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body ``` -------------------------------- ### Prepare Deployment Go SDK Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agents/preparedeployment.md Go example using net/http to POST to the Prepare Deployment endpoint. Sends JSON payload and prints response. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api/agents/deployments/preview" payload := strings.NewReader("{\n \"orgSlug\": \"string\",\n \"agentStableKeys\": [\n \"string\"\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-API-Key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Create Project with Go net/http Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/teams/createproject.md Go example using the standard net/http package to send a POST request. Reads the response body and prints it. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api/teams/teamId/projects" payload := strings.NewReader("{\n \"orgSlug\": \"string\",\n \"name\": \"string\",\n \"goal\": \"string\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-API-Key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Go SDK example for GET /api/elladex/agents/{address} Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/elladex/getagent.md Uses net/http to send a GET request and prints the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api/elladex/agents/address" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### JavaScript SDK example for GET /api/elladex/agents/{address} Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/elladex/getagent.md Uses fetch with async/await to send a GET request and logs the response data or error. ```javascript const url = 'https://api/elladex/agents/address'; const options = {method: 'GET'}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Create Agent SDK Example (Go) Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agents/create.md Go example using net/http to POST to https://api/agents with X-API-Key header and JSON payload. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api/agents" payload := strings.NewReader("{\n \"orgSlug\": \"string\",\n \"stableKey\": \"string\",\n \"provider\": \"string\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-API-Key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Python SDK example for GET /api/elladex/agents/{address} Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/elladex/getagent.md Uses the requests library to send a GET request to the endpoint and prints the JSON response. ```python import requests url = "https://api/elladex/agents/address" response = requests.get(url) print(response.json()) ``` -------------------------------- ### PHP SDK example using Guzzle Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/teams/createmembermemory.md PHP example using the Guzzle HTTP client to POST to the Create Team Member Memory endpoint. Requires Guzzle to be installed via Composer. ```php request('POST', 'https://api/teams/teamId/agents/agentId/memories', [ 'body' => '{ "orgSlug": "string", "content": "string", "visibility": "private" }', 'headers' => [ 'Content-Type' => 'application/json', 'X-API-Key' => '', ], ]); echo $response->getBody(); ``` -------------------------------- ### Go SDK example using net/http Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/teams/createmembermemory.md Go example using the standard net/http package to POST to the Create Team Member Memory endpoint. Includes error handling and prints the response. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api/teams/teamId/agents/agentId/memories" payload := strings.NewReader("{\n \"orgSlug\": \"string\",\n \"content\": \"string\",\n \"visibility\": \"private\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-API-Key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Create Channel with PHP Guzzle Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/notifications/createchannel.md PHP example using GuzzleHttp to POST to the notifications channels endpoint. Requires Guzzle installed. ```php request('POST', 'https://api/notifications/channels', [ 'body' => '{ "name": "string", "orgSlug": "string", "type": "EMAIL" }', 'headers' => [ 'Content-Type' => 'application/json', 'X-API-Key' => '', ], ]); echo $response->getBody(); ``` -------------------------------- ### Go SDK Example Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agents/dispatchremoval.md Go example using net/http to POST to the Dispatch Agent Removal endpoint. Requires X-API-Key header. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api/agents/removals/dispatch" payload := strings.NewReader("{\n \"orgSlug\": \"string\",\n \"environmentId\": \"string\",\n \"environmentName\": \"string\",\n \"agentStableKeys\": [\n \"string\"\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-API-Key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### PHP SDK POST request Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agent-index/agent-index-create-listing.md PHP example using GuzzleHttp to POST to the agent-index listings endpoint. Requires Guzzle installed. ```php request('POST', 'https://api/agent-index/listings', [ 'body' => '{ "orgSlug": "string", "slug": "string", "displayName": "string" }', 'headers' => [ 'Content-Type' => 'application/json', 'X-API-Key' => '', ], ]); echo $response->getBody(); ``` -------------------------------- ### Go SDK example for testing prompt provider Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/prompt-providers/prompt-providers-test.md Uses net/http to POST to the test endpoint with X-API-Key authentication and prints the response. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api/prompt-providers/id/test" payload := strings.NewReader("{\n \"orgSlug\": \"string\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-API-Key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### PHP: GET /api/governance/policies with Guzzle Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/governance/listpolicies.md PHP example using GuzzleHttp to call the endpoint with an X-API-Key header and orgSlug query parameter. Echoes the response body. ```php request('GET', 'https://api/governance/policies?orgSlug=orgSlug', [ 'headers' => [ 'X-API-Key' => '', ], ]); echo $response->getBody(); ``` -------------------------------- ### Go SDK Example for Fetch Provider Prompts Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/import/prm-import-fetch-provider-prompts.md Go code using net/http to POST to the fetch-provider-prompts endpoint. Sets headers and prints the response. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api/import/fetch-provider-prompts" payload := strings.NewReader("{\n \"organizationId\": \"string\",\n \"provider\": \"vapi\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-API-Key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Java: GET /api/governance/policies with Unirest Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/governance/listpolicies.md Java example using Unirest to call the endpoint with an X-API-Key header and orgSlug query parameter. Returns the response as a string. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api/governance/policies?orgSlug=orgSlug") .header("X-API-Key", "") .asString(); ``` -------------------------------- ### Create Task SDK Example in JavaScript Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/teams/createtask.md JavaScript example using fetch to POST to the Create Task endpoint. Uses async/await and logs the response or error. ```javascript const url = 'https://api/teams/teamId/tasks'; const options = { method: 'POST', headers: {'X-API-Key': '', 'Content-Type': 'application/json'}, body: '{"orgSlug":"string","title":"string"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Swift: GET /api/governance/policies with URLSession Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/governance/listpolicies.md Swift example using URLSession to call the endpoint with an X-API-Key header and orgSlug query parameter. Prints the HTTP response or error. ```swift import Foundation let headers = ["X-API-Key": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api/governance/policies?orgSlug=orgSlug")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Go SDK example for Draft Compile Preview Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/drafts/prm-drafts-compile-preview.md Go example using net/http to POST to the Draft Compile Preview endpoint. Requires an API key in the X-API-Key header. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api/draft-compile-previews" payload := strings.NewReader("{\n \"registryRef\": \"string\",\n \"promptName\": \"string\",\n \"artifactType\": \"prompt\",\n \"body\": \"string\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-API-Key", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### C#: GET /api/governance/policies with RestSharp Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/governance/listpolicies.md C# example using RestSharp to call the endpoint with an X-API-Key header and orgSlug query parameter. Executes the request and stores the response. ```csharp using RestSharp; var client = new RestClient("https://api/governance/policies?orgSlug=orgSlug"); var request = new RestRequest(Method.GET); request.AddHeader("X-API-Key", ""); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Swift SDK Example for Update Deployment Tool Refs Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agents/updatedeploymenttoolrefs.md Swift example using URLSession to send PATCH request with X-API-Key header. ```swift import Foundation let headers = [ "X-API-Key": "", "Content-Type": "application/json" ] let parameters = [ "orgSlug": "string", "promptName": "string", "toolRefs": ["string"] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api/agents/stableKey/tool-refs")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PATCH" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Go: GET /api/governance/policies with net/http Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/governance/listpolicies.md Go example using net/http to call the endpoint with an X-API-Key header and orgSlug query parameter. Prints the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api/governance/policies?orgSlug=orgSlug" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("X-API-Key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### JavaScript: GET /api/governance/policies with fetch Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/governance/listpolicies.md JavaScript example using fetch to call the endpoint with an X-API-Key header and orgSlug query parameter. Logs the response data or error. ```javascript const url = 'https://api/governance/policies?orgSlug=orgSlug'; const options = {method: 'GET', headers: {'X-API-Key': ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Python: GET /api/governance/policies with requests Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/governance/listpolicies.md Python example using the requests library to call the endpoint with an X-API-Key header and orgSlug query parameter. Prints the JSON response. ```python import requests url = "https://api/governance/policies" querystring = {"orgSlug":"orgSlug"} headers = {"X-API-Key": ""} response = requests.get(url, headers=headers, params=querystring) print(response.json()) ``` -------------------------------- ### JavaScript SDK Example for Update Deployment Tool Refs Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agents/updatedeploymenttoolrefs.md JavaScript example using fetch to send PATCH request with X-API-Key header. ```javascript const url = 'https://api/agents/stableKey/tool-refs'; const options = { method: 'PATCH', headers: {'X-API-Key': '', 'Content-Type': 'application/json'}, body: '{"orgSlug":"string","promptName":"string","toolRefs":["string"]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Ruby SDK example for create key challenge Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agent-index/agent-index-create-key-challenge.md Ruby example using net/http to POST to /agent-index/key-challenges with X-API-Key header and JSON body. ```ruby require 'uri' require 'net/http' url = URI("https://api/agent-index/key-challenges") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["X-API-Key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"orgSlug\": \"string\",\n \"pubkey\": \"string\"\n}" response = http.request(request) puts response.read_body ``` -------------------------------- ### Ruby: GET /api/governance/policies with Net::HTTP Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/governance/listpolicies.md Ruby example using Net::HTTP to call the endpoint with an X-API-Key header and orgSlug query parameter. Prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api/governance/policies?orgSlug=orgSlug") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["X-API-Key"] = '' response = http.request(request) puts response.read_body ``` -------------------------------- ### Create Policy Ruby SDK Example Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/governance/createpolicy.md Ruby example using net/http to POST to /governance/policies with X-API-Key header. Prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api/governance/policies") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["X-API-Key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"orgSlug\": \"string\",\n \"name\": \"string\"\n}" response = http.request(request) puts response.read_body ``` -------------------------------- ### Java SDK example for updating agent by stable key Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agents/update.md Uses Unirest to send a PATCH request to https://api/agents/stableKey with X-API-Key and Content-Type headers. Sends the JSON body and gets a string response. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.patch("https://api/agents/stableKey") .header("X-API-Key", "") .header("Content-Type", "application/json") .body("{\n \"orgSlug\": \"string\"\n}") .asString(); ``` -------------------------------- ### Java SDK example for create key challenge Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agent-index/agent-index-create-key-challenge.md Java example using Unirest to POST to /agent-index/key-challenges with X-API-Key header and JSON body. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api/agent-index/key-challenges") .header("X-API-Key", "") .header("Content-Type", "application/json") .body("{\n \"orgSlug\": \"string\",\n \"pubkey\": \"string\"\n}") .asString(); ``` -------------------------------- ### Java Unirest GET request to get version content Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/registries/prm-registry-get-version-content.md Uses Unirest to send a GET request with X-API-Key header. Returns the response as a string. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api/registries/artifact-versions/content?model=model&promptName=promptName®istryRef=registryRef&version=version") .header("X-API-Key", "") .asString(); ``` -------------------------------- ### Ruby GET request to get version content Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/registries/prm-registry-get-version-content.md Uses net/http with SSL to send a GET request with X-API-Key header. Prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api/registries/artifact-versions/content?model=model&promptName=promptName®istryRef=registryRef&version=version") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["X-API-Key"] = '' response = http.request(request) puts response.read_body ``` -------------------------------- ### Go GET request to get version content Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/registries/prm-registry-get-version-content.md Uses net/http to send a GET request with X-API-Key header. Prints the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api/registries/artifact-versions/content?model=model&promptName=promptName®istryRef=registryRef&version=version" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("X-API-Key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Create Environment SDK Code (Java) Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/environments/create.md Java example using Unirest to POST to /environments with X-API-Key header. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api/environments") .header("X-API-Key", "") .header("Content-Type", "application/json") .body("{\n \"orgSlug\": \"string\",\n \"name\": \"string\"\n}") .asString(); ``` -------------------------------- ### Swift URLSession GET request to get version content Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/registries/prm-registry-get-version-content.md Uses URLSession with X-API-Key header to send a GET request. Prints the HTTP response or error. ```swift import Foundation let headers = ["X-API-Key": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api/registries/artifact-versions/content?model=model&promptName=promptName®istryRef=registryRef&version=version")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### PHP Guzzle GET request to get version content Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/registries/prm-registry-get-version-content.md Uses GuzzleHttp client to send a GET request with X-API-Key header. Echoes the response body. ```php request('GET', 'https://api/registries/artifact-versions/content?model=model&promptName=promptName®istryRef=registryRef&version=version', [ 'headers' => [ 'X-API-Key' => '', ], ]); echo $response->getBody(); ``` -------------------------------- ### C#: GET /api/elladex/capabilities Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/elladex/capabilityfacets.md Uses RestSharp to create a GET request and execute it against the endpoint. ```csharp using RestSharp; var client = new RestClient("https://api/elladex/capabilities"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Create Environment SDK Code (Ruby) Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/environments/create.md Ruby example using net/http to POST to /environments with X-API-Key header. ```ruby require 'uri' require 'net/http' url = URI("https://api/environments") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["X-API-Key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"orgSlug\": \"string\",\n \"name\": \"string\"\n}" response = http.request(request) puts response.read_body ``` -------------------------------- ### Python SDK Example for Update Deployment Tool Refs Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agents/updatedeploymenttoolrefs.md Python example using requests library to send PATCH request with X-API-Key header. ```python import requests url = "https://api/agents/stableKey/tool-refs" payload = { "orgSlug": "string", "promptName": "string", "toolRefs": ["string"] } headers = { "X-API-Key": "", "Content-Type": "application/json" } response = requests.patch(url, json=payload, headers=headers) print(response.json()) ``` -------------------------------- ### Swift: GET /api/elladex/capabilities Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/elladex/capabilityfacets.md Uses URLSession to perform a GET request and prints the response or error. ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api/elladex/capabilities")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Ruby SDK Example for Update Deployment Tool Refs Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/agents/updatedeploymenttoolrefs.md Ruby example using net/http to send PATCH request with X-API-Key header. ```ruby require 'uri' require 'net/http' url = URI("https://api/agents/stableKey/tool-refs") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Patch.new(url) request["X-API-Key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"orgSlug\": \"string\",\n \"promptName\": \"string\",\n \"toolRefs\": [\n \"string\"\n ]\n}" response = http.request(request) puts response.read_body ``` -------------------------------- ### PHP: GET /api/elladex/capabilities Source: https://docs.ellaworks.ai/api-reference/ellaworks-prm-api/elladex/capabilityfacets.md Uses GuzzleHttp\Client to send a GET request and echoes the response body. ```php request('GET', 'https://api/elladex/capabilities'); echo $response->getBody(); ```