Czy ta treść była pomocna?
Co możemy zrobić, aby czytelnik mógł wynieść więcej korzyści z tego artykułu?
All the permissions created for the account are listed.
The GET /permissions/ allows listing all the permissions of the account. Optionally, you can specify the name to get the specific permission in the account.
GET /permissions
Name | In | Type | Required | Description |
---|---|---|---|---|
name | query | string | false | This is an optional parameter. Query the name parameter for single permission. |
package main import ( "net/http" ) func main() { headers := map[string][]string{ "Accept": []string{ "application/json", }, "Authorization": []string{ "Bearer {access-token}", }, } req, err := http.NewRequest("GET", "https://api.lyvecloud.seagate.com/v2/permissions/", nil) if err != nil { // handle error } req.Header = headers client := &http.Client{} resp, err := client.Do(req) if err != nil { // handle error } // handle response _ = resp }
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) { try { URL obj = new URL("https://api.lyvecloud.seagate.com/v2/permissions/"); 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()); } catch (Exception e) { e.printStackTrace(); } } }
const headers = { 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}' }; fetch('https://api.lyvecloud.seagate.com/v2/permissions/', { method: 'GET', headers: headers }) .then(function(res) { if (!res.ok) { throw new Error(`HTTP error! status: ${res.status}`); } return res.json(); }) .then(function(body) { console.log(body); }) .catch(function(error) { console.log('There was a problem with the fetch operation: ' + error.message); });
import requests headers = { 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}' } try: r = requests.get('https://api.lyvecloud.seagate.com/v2/permissions/', headers=headers) r.raise_for_status() # Raises a HTTPError if the response status is 4xx, 5xx print(r.json()) except requests.exceptions.RequestException as err: print ("There was a problem with the request:", err)
require 'rest-client' require 'json' headers = { 'Accept' => 'application/json', 'Authorization' => 'Bearer {access-token}' } begin result = RestClient.get 'https://api.lyvecloud.seagate.com/v2/permissions/', headers: headers p JSON.parse(result) rescue RestClient::ExceptionWithResponse => e e.response end
Status Code | Description | Return JSON payload | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
200 | OK Successfully returned permission list. |
[ { "name": "string", "id": "string", "description": "string", "type": "all-buckets", "readyState": true, "createTime": "2019-08-24T14:15:22Z" } ]
|
||||||||||||||
400 | Bad request Either the token is invalid or expired. |
{ "code": "string", "message": "string" }
|
||||||||||||||
404 | Not Found The permission is no longer available. |
{ "code": "string", "message": "string" }
|
||||||||||||||
403 | Forbidden The account has no services enabled. |
{ "code": "string", "message": "string" }
|
||||||||||||||
500 | The server encountered an internal error | { "code": "string", "message": "string" }
|
||||||||||||||
503 | Service Unavailable | { "code": "string", "message": "string" }
|