Cet article vous a-t-il été utile ?
Comment pourrions-nous l'améliorer ?
All service accounts in the account are listed or a specific service account is listed. Each service account has a unique identifier.
The GET API lists all the service accounts or a specific service account.
GET /service-accounts
Name |
In |
Type |
Required |
Description |
---|---|---|---|---|
name |
query |
string |
false |
This is an optional parameter. Use the parameter to query for a single service account by name. |
package main import ( "net/http" "io/ioutil" "fmt" ) func main() { headers := map[string][]string{ "Accept": { "application/json", }, "Authorization": { "Bearer {access-token}", }, } req, err := http.NewRequest("GET", "https://api.lyvecloud.seagate.com/v2/service-accounts/", nil) if err != nil { // handle error } req.Header = headers client := &http.Client{} resp, err := client.Do(req) if err != nil { // handle error } // Read response defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) }
import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class Main { public static void main(String[] args) throws Exception { URL url = new URL("https://api.lyvecloud.seagate.com/v2/service-accounts/"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); // Set headers con.setRequestProperty("Accept", "application/json"); con.setRequestProperty("Authorization", "Bearer {access-token}"); // Get response code int responseCode = con.getResponseCode(); System.out.println("Response Code : " + responseCode); // Read response try(BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), "utf-8"))) { StringBuilder response = new StringBuilder(); String responseLine = null; while ((responseLine = br.readLine()) != null) { response.append(responseLine.trim()); } System.out.println(response.toString()); } } }
const headers = { 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}' }; fetch('https://api.lyvecloud.seagate.com/v2/service-accounts/', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); });
import requests headers = { 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}' } r = requests.get('https://api.lyvecloud.seagate.com/v2/service-accounts/', headers = headers) print(r.json())
require 'rest-client' require 'json' headers = { 'Accept' => 'application/json', 'Authorization' => 'Bearer {access-token}' } result = RestClient.get 'https://api.lyvecloud.seagate.com/v2/service-accounts/', params: {}, headers: headers puts JSON.parse(result)
Status Code | Description | Schema | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
200 | OK The operation is successful. |
[ { "name": "string", "id": "string", "enabled": true, "readyState": true, "description": "string" } ]
|
||||||||||||
400 | Bad request The token is either invalid or expired. |
{ "code": "string", "message": "string" }
|
||||||||||||
403 | Forbidden The account has no services enabled. |
{ "code": "string", "message": "string" }
|
||||||||||||
404 | The service account was not found. | { "code": "string", "message": "string" }
|
||||||||||||
500 | The server encountered an internal error. | { "code": "string", "message": "string" }
|
||||||||||||
503 | Service Unavailable | { "code": "string", "message": "string" }
|