Heeft deze informatie u geholpen?
Hoe kunnen we dit artikel nog verbeteren?
Permission ID is a unique identifier for a permission.
Performing a GET operation on specific permission retrieves the permission.
GET /permissions/{permissionId}
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| permissionId | path | string | true | Numeric ID of the 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/{PermissionId}", 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/{PermissionId}");
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/{PermissionId}', {
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/{PermissionId}', 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}'
}
result = RestClient.get 'https://api.lyvecloud.seagate.com/v2/permissions/{PermissionId}', params: {}, headers: headers
puts JSON.parse(result)
| Status Code | Description | Return JSON Payload | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 200 | OK Specified Permission ID is found, and the details are returned in the response. |
{
"id": "string",
"name": "string",
"description": "string",
"type": "all-buckets",
"readyState": true,
"actions": "all-operations",
"prefix": "string",
"buckets": [ "string" ],
"policy": {}
}
Note—If the type is policy, then the fields actions, prefix, and buckets will not display.
|
||||||||||||||||||||
| 400 | Either the token is not valid or expired. |
{
"code": "string",
"message": "string"
}
|
||||||||||||||||||||
| 403 | Forbidden The account has no services enabled. |
{
"code": "string",
"message": "string"
}
|
||||||||||||||||||||
| 404 | Not Found The permission is not available. |
{
"code": "string",
"message": "string"
}
|
||||||||||||||||||||
| 500 | An internal error has occurred. |
{
"code": "string",
"message": "string"
}
|
||||||||||||||||||||
| 503 | Service Unavailable |
{
"code": "string",
"message": "string"
}
|