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

Was this content helpful?

Getting Service Account Data by ID

You can retrieve a specific service account using the unique identifier.

Request

The GET operation returns the service accounts as specified in the parameters.

GET /service-accounts/{serviceAccountId}

Parameters

NameInTypeRequiredDescription
serviceAccountIdpathstringtrueNumeric ID of the service account.

Code samples

Go

    package main

    import (
        "bytes"
        "net/http"
    )

    func main() {
        headers := map[string][]string{
            "Accept": []string{
                "application/json",
            },
            "Authorization": []string{
                "Bearer {access-token}",
            },
        }
        data := bytes.NewBuffer([]byte{jsonReq})
        req, err := http.NewRequest("GET", "https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}", data)
        req.Header = headers
        client := &http.Client{}
        resp, err := client.Do(req)
        // ... }

Java

    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.io.BufferedReader;
    import java.io.InputStreamReader;

    public class Main {
        public static void main(String[] args) throws Exception {
            URL obj = new URL("https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}");
            HttpURLConnection con = (HttpURLConnection) obj.openConnection();
            con.setRequestMethod("GET");
            int responseCode = con.getResponseCode();
            BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
            String inputLine;
            StringBuffer response = new StringBuffer();
            while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); } }

JavaScript

    const headers = {
        'Accept': 'application/json',
        'Authorization': 'Bearer {access-token}'
    };

    fetch('https://api.lyvecloud.seagate.com/v2/service-accounts/{ServiceAccountId}', {
        method: 'GET', headers: headers }) .then(res => res.json()) .then(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/{ServiceAccountId}', 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/{ServiceAccountId}', params: {}, headers: headers

    puts JSON.parse(result)
  

Responses

Status CodeDescriptionSchema
200OK
{ 
  "id": "string", 
  "name": "string", 
  "description": "string", 
  "enabled": true, 
  "readyState": true, 
  "permissions": [ "string" ]
}
FieldDescription
idID of the service account.
nameService account name.
descriptionService account description.
enabledSpecifies if the service account is enabled or disabled.
readyStateState of the service account. True if the service account is ready across all regions.
permissionsPermission name associated with 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.