SAVE AS PDF
Lyve Cloud Account API version 2 Guide
Lyve Cloud Account API version 2 

Was this content helpful?

Listing Service Accounts

All service accounts in the account are listed or a specific service account is listed. Each service account has a unique identifier.

Request

The GET API lists all the service accounts or a specific service account.

GET /service-accounts

Parameters

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.

Code samples

Go

    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)) }

Java

    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()); } } }

JavaScript

    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); });

Python

    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())

Ruby

    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)
  

Responses

Status CodeDescriptionSchema
200OK

The operation is successful.
[ 
 { 
   "name": "string", 
   "id": "string", 
   "enabled": true, 
   "readyState": true, 
   "description": "string" 
 }
]
FieldDescription
nameName of the service account.
idID of a service account.
enabledState of the Service Account. It can be enabled or disabled.
readyStateTrue if the service account is ready across all regions.
descriptionDescription of the service account.
400Bad request

The token is either invalid or expired.
{
  "code": "string",
  "message": "string"
}
codemessage
ExpiredTokenToken expired.
InvalidTokenToken is not valid.
403Forbidden

The account has no services enabled.
{
  "code": "string",
  "message": "string"
}
codemessage
NoServiceAvailableThe account has no services enabled for it.
404The service account was not found.
{
  "code": "string",
  "message": "string"
}
codemessage
ServiceAccountNotFoundService account was not found.
500The server encountered an internal error.
{
  "code": "string",
  "message": "string"
}
codemessage
InternalErrorThe server encountered an internal error. Please retry the request.
503Service Unavailable
{
  "code": "string",
  "message": "string"
}
codemessage
ServiceNotReadyThe server is not ready to handle the request. Please retry the request later.