Object Storage

Create an API Key and access token:-

For create a API Key and Access Token to refer this link :-

https://www.e2enetworks.com/help/knowledge-base/how-to-create-an-api-access-token/

List of Bucket

To find the list of bucket(s), send a HTTP GET request to the eos endpoint

https://api.e2enetworks.com/myaccount/api/v1/storage/buckets/?apikey={{API_Key}}

The request returns a JSON object that contains the following attributes:

Name

Type

Description

versioning_status

string

A string denotes the versioning state of the bucket. ‘on’ for enable and‘off’ for disable.

id

Integer

A unique integer identifier created and assigned to the bucket after its creation.

name

String

The name assigned to the bucket.

bucket_size

integer

An integer denotes the size of the bucket in <>.

created_at

Integer

A string represents both the date and time when the bucket is created.

PYTHON

1. Python - http.client Example

 import http.client

 conn = http.client.HTTPSConnection("api.e2enetworks.com")
 payload = ''
 headers = {
           'Authorization': 'api_token'
      }
 conn.request("GET", "/myaccount/api/v1/storage/buckets/?apikey={{api_key}}", payload, headers)
 res = conn.getresponse()
 data = res.read()
 print(data.decode("utf-8"))
2. Python - Requests Example

    import requests

   url = "https://api.e2enetworks.com/myaccount/api/v1/storage/buckets/?apikey={{api_key}}"

   payload={}
    headers = {
           'Authorization': 'api_token',
       }

   response = requests.request("GET", url, headers=headers, data=payload)

   print(response.text)

Headers

Request Headers

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...

Response Headers:-

content-type: application/json; charset=utf-8
status: 202 Accepted

Body

Response Body

{
  "code": 200,
  "data": [
      {
          "id": 2277,
          "name": "realtest4",
          "created_by": 5652,
          "status": "NEW",
          "created_at": "2022-04-14T16:28:12.929591Z",
          "updated_at": "2022-04-14T16:28:12.929704Z",
          "bucket_size": "233.87 KB",
          "versioning_status": "Off",
          "lifecycle_configuration_status": "Not-Configured"
      },
                   {
          "id": 2292,
          "name": "bucket112",
          "created_by": 5652,
          "status": "NEW",
          "created_at": "2022-04-18T04:24:18.302700Z",
          "updated_at": "2022-04-18T04:24:18.302794Z",
          "bucket_size": "95.46 MB",
          "versioning_status": "Off",
          "lifecycle_configuration_status": "Not-Configured"
      }
  ],
  "errors": {},
  "message": "Success"
}

Create a new Bucket-

To create a Bucket , send a Post request eos end point:-

https://api.e2enetworks.com/myaccount/api/v1/storage/buckets/{{bucket_name}}/?apikey={{api_key}}

The request returns a JSON object that contains the following attributes:

Name

Type

Description

versioning_status

string

A string denotes the versioning state of the bucket. ‘on’ for enable and‘off’ for disable.

id

Integer

A unique integer identifier created and assigned to the bucket after its creation.

name

String

The name assigned to the bucket.

bucket_size

integer

An integer denotes the size of the bucket in <>.

created_at

Integer

A string represents both the date and time when the bucket is created.

PYTHON

1. Python - http.client Example

 import http.client

 conn = http.client.HTTPSConnection("api.e2enetworks.com")
 payload = ''
 headers = {
         'Authorization': 'api_token'
      }
 conn.request("POST", "/myaccount/api/v1/storage/buckets/{{bucket_name}}/?apikey={{api_key}}", payload, headers)
 res = conn.getresponse()
 data = res.read()
 print(data.decode("utf-8"))
2. Python - Requests Example

   import requests

   url = "https://api.e2enetworks.com/myaccount/api/v1/storage/buckets/{{bucket_name}}/?apikey={{api_key}}"

   payload={}
   headers = {
               'Authorization': 'api_token'
        }

   response = requests.request("POST", url, headers=headers, data=payload)

   print(response.text)

Headers

Request Headers

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...

Response Headers:-

content-type: application/json; charset=utf-8
status: 202 Accepted

Body

Response Body

{
  "code": 200,
  "data": {
      "id": 2308,
      "name": "shubh111",
      "created_by": 5652,
      "status": "NEW",
      "used_MB": null,
      "created_at": "2022-04-21T10:27:42.572422Z",
      "updated_at": "2022-04-21T10:27:42.572525Z",
      "versioning_status": "Off",
      "lifecycle_configuration_status": "Not-Configured"
  },
  "errors": {},
  "message": "Success"
}

Delete a Bucket -

To delete a Bucket , send a DELETE request to eos end point:-

https://api.e2enetworks.com/myaccount/api/v1/storage/buckets/{{bucket_name}}/?apikey={{api_key}}

PYTHON

1. Python - http.client Example

 import http.client

 conn = http.client.HTTPSConnection("api.e2enetworks.com")
 payload = ''
 headers = {
             'Authorization': 'api_token'
       }
 conn.request("DELETE", "/myaccount/api/v1/storage/buckets/{{bucket_name}}/?apikey={{api_key}}",
 payload, headers)
 res = conn.getresponse()
 data = res.read()
 print(data.decode("utf-8"))
2. Python - Requests Example

   import requests

  url = "https://api.e2enetworks.com/myaccount/api/v1/storage/buckets/{{bucket_name}}/?apikey={{api_key}}"

  payload={}
  headers = {
       'Authorization': 'api_token'
         }

  response = requests.request("DELETE", url, headers=headers, data=payload)

  print(response.text)

Headers

Request Headers

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...

Response Headers:-

content-type: application/json; charset=utf-8
status: 202 Accepted

Body

Response Body

{
  "code": 200,
  "data": {},
  "errors": {},
  "message": "Success"
}

Enable Bucket Versioning

To enable Bucket versioning , send a Post request eos end point :-

https://api.e2enetworks.com/myaccount/api/v1/storage/bucket_versioning/{{bucket_name}}/?apikey={{api_key}}&location=Delhi

Attributes and respective values required to send this POST request are:

Name

Type

Description

Required

bucket_name

char

Provide the name of the bucket on which versioning is to be appiled.

True

new_versioning_state

String

Provide the versioning_state enable if you want to enable the versioning.

True

PYTHON

1. Python - http.client Example

 import http.client
 import json

 conn = http.client.HTTPSConnection("api.e2enetworks.com")
 payload = json.dumps({
        "bucket_name": "bucket_name",
        "new_versioning_state": "Enabled"
         })
 headers = {
         'Authorization': 'api_token',
         'Content-Type': 'application/json',
       }
 conn.request("POST", "/myaccount/api/v1/storage/bucket_versioning/{{bucket_name}}/?apikey={{api_key}}&location=Delhi", payload, headers)
  res = conn.getresponse()
  data = res.read()
  print(data.decode("utf-8"))
2. Python - Requests Example

  import requests
  import json

  url = "https://api.e2enetworks.com/myaccount/api/v1/storage/bucket_versioning/{{bucket_name}}/?apikey={{api_key}}&location=Delhi"

 payload = json.dumps({
 "bucket_name": "bucketname",
 "new_versioning_state": "Enabled"
 })
 headers = {
 'Authorization': 'api_token',
 'Content-Type': 'application/json',
 }

 response = requests.request("POST", url, headers=headers, data=payload)

 print(response.text)

Headers

Request Headers

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...

Response Headers:-

content-type: application/json; charset=utf-8
status: 202 Accepted

Body

Request Body-

{
  "bucket_name": "bucket_name",
  "new_versioning_state": "Enabled"
}

Response Body

{
  "code": 200,
  "data": {
      "bucket_name": "bucket_name",
      "bucket_versioning_status": "Enabled"
  }
  "errors": {},
  "message": "Success"

}

Disable Bucket Versioning

To Disable Bucket versioning , send a Post request-

https://api.e2enetworks.com/myaccount/api/v1/storage/bucket_versioning/bucket_name/?apikey={{api_key}}&location=Delhi

Attributes and respective values required to send this POST request are:

Name

Type

Description

Required

bucket_name

char

Provide the name of the bucket on which versioning is to be appiled.

True

new_versioning_state

String

Provide the versioning_state enable if you want to enable the versioning.

True

PYTHON

1. Python - http.client Example

 import http.client
 import json

 conn = http.client.HTTPSConnection("api.e2enetworks.com")
 payload = json.dumps({
 "bucket_name": "bucketname",
 "new_versioning_state": "Disabled"
 })
 headers = {
 'Authorization': 'api_token',
 'Content-Type': 'application/json',
 }
 conn.request("POST", "/myaccount/api/v1/storage/bucket_versioning/{{bucket_name}}/?apikey={{api_key}}&location=Delhi", payload, headers)
 res = conn.getresponse()
 data = res.read()
 print(data.decode("utf-8"))
2. Python - Requests Example

 import requests
 import json

 url = "https://api.e2enetworks.com/myaccount/api/v1/storage/bucket_versioning/{{bucket_name}}/?apikey={{api_key}}&location=Delhi"

 payload = json.dumps({
 "bucket_name": "bucketname",
 "new_versioning_state": "Disabled"
 })
 headers = {
 'Authorization': 'api_token',
 'Content-Type': 'application/json',
 }

 response = requests.request("POST", url, headers=headers, data=payload)

 print(response.text)

Headers

Request Headers

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...

Response Headers:-

content-type: application/json; charset=utf-8
status: 202 Accepted

Body

Request Body-

{
  "bucket_name": "bucket_name",
  "new_versioning_state": "Disabled"
}

Response Body

{
  "code": 200,
  "data": {
      "bucket_name": "bucket_name",
      "bucket_versioning_status": "Suspended"
  },
  "errors": {},
  "message": "Success"
}

Applied Life Cycle rule

To Applied a life cycle rule in bucket to send a Post request-

https://api.e2enetworks.com/myaccount/api/v1/storage/bucket_lifecycle/{{bucket_name}}/?apikey={{api_key}}

Attributes and respective values required to send this POST request are:

The request returns a JSON object that contains the following attributes:

PYTHON

1. Python - http.client Example

 import http.client
 import json

 conn = http.client.HTTPSConnection("api.e2enetworks.com")
 payload = json.dumps({
 "bucket_name": "bucketname",
 "lifecycle_rules": [
   {
     "expiration_days": 1,
     "new_status": "Enabled",
     "noncurrent_version_expiration_date_or_days": 1,
     "prefix": "",
     "rule_id": 0
   }
  ]
 })
 headers = {
    'Authorization': 'api_token',
    'Content-Type': 'application/json',
  }
 conn.request("PUT", "/myaccount/api/v1/storage/bucket_lifecycle/{{bucket_name}}/?apikey={{api_key}}", payload, headers)
 res = conn.getresponse()
 data = res.read()
 print(data.decode("utf-8"))
2. Python - Requests Example

 import requests
 import json

 url = "https://api.e2enetworks.com/myaccount/api/v1/storage/bucket_lifecycle/{{bucket_name}}/?apikey={{api_key}}"

 payload = json.dumps({
 "bucket_name": "bucketname",
 "lifecycle_rules": [
   {
     "expiration_days": 1,
     "new_status": "Enabled",
     "noncurrent_version_expiration_date_or_days": 1,
     "prefix": "",
     "rule_id": 0
   }
 ]
 })
 headers = {
    'Authorization': 'api_token',
    'Content-Type': 'application/json',
  }

  response = requests.request("PUT", url, headers=headers, data=payload)

  print(response.text)

Headers

Request Headers

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...

Response Headers:-

content-type: application/json; charset=utf-8
status: 202 Accepted

Body

Request Body-

{
  "bucket_name": "bucketname",
  "lifecycle_rules": [
      {
          "expiration_days": 1,
          "new_status": "Enabled",
          "noncurrent_version_expiration_date_or_days": 1,
          "prefix": "",
          "rule_id": 0
      }
  ]
}

Response Body

{
  "code": 200,
  "data": [
      {
          "id": 115,
          "deleted": false,
          "created_at": "2022-04-14T16:31:11.493637Z",
          "updated_at": "2022-04-14T16:31:11.493717Z",
          "rule_id": "bc6e8f217adc4cffb0fe6711d416b73b",
          "enabled": true,
          "prefix": "",
          "expiry_date_or_days": "1",
          "noncurrent_version_expiration_date_or_days": "",
          "transition": "",
          "storage_class": "",
          "tags": "",
          "bucket": 2279,
          "user": 5652
      },
                  ],
  "errors": {},
  "message": "Success"
}

List of all Access Key

To find the list of all access key , send a Get request-

https://api.e2enetworks.com/myaccount/api/v1/storage/core/list/users/?apikey={{api_key}}

The request returns a JSON object that contains the following attributes:

Name

Type

Description

id

Integer

A unique integer identifier created and assigned to the bucket after its creation.

user_name

string

Show the name of the user.

tag

char

Char shows the name of the access key.

access_key

string

Unique identifier for the rule. The value can’t be longer than 255 characters.

PYTHON

1. Python - http.client Example

 import http.client

 conn = http.client.HTTPSConnection("api.e2enetworks.com")
  payload = ''
  headers = {
     'Authorization': 'api_token',
  }
 conn.request("GET", "/myaccount/api/v1/storage/core/list/users/?apikey={{api_key}}", payload, headers)
 res = conn.getresponse()
 data = res.read()
 print(data.decode("utf-8"))
2. Python - Requests Example

 import requests

 url = "https://api.e2enetworks.com/myaccount/api/v1/storage/core/list/users/?apikey={{api_key}}"

 payload={}
 headers = {
    'Authorization': 'api_token'
  }

  response = requests.request("GET", url, headers=headers, data=payload)

  print(response.text)

Headers

Request Headers

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...

Response Headers:-

content-type: application/json; charset=utf-8
status: 202 Accepted

Body

Response Body

{
  "code": 200,
  "data": [
      {
          "id": 5792,
          "my_account_id": null,
          "user_name": "{{username}}",
          "email": "",
          "access_key": "9TN9PJNQ3K3LPEDGGIYU",
          "secret_key": null,
          "is_default": false,
          "disabled": false,
          "tag": "key1"
      },
                   ],
  "errors": {},
  "message": "Success"
}

Create Access Key

To create a access key, send a Post request to eos end point :-

https://api.e2enetworks.com/myaccount/api/v1/storage/core/users/?apikey={{api_key}}

Attributes and respective values required to send this POST request are:

Name

Type

Description

Required

tag

char

Provide the name of the access key.

True

The request returns a JSON object that contains the following attributes:

Name

Type

Description

id

Integer

A unique integer identifier created and assigned to the bucket after its creation.

user_name

string

Show the name of the user.

tag

char

Char shows the name of the access key.

access_key

string

Unique identifier for the rule. The value can’t be longer than 255 characters.

secret_key

string

An unique identifier for the rule.

PYTHON

1. Python - http.client Example

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
 payload = json.dumps({
    "tag": "uni4"
   })
 headers = {
    'Authorization': 'api_token'
    'Content-Type': 'application/json',
  }
  conn.request("POST", "/myaccount/api/v1/storage/core/users/?apikey={{api_key}}",
  payload, headers)
   res = conn.getresponse()
  data = res.read()
  print(data.decode("utf-8"))
2. Python - Requests Example

 import requests
 import json

 url = "https://api.e2enetworks.com/myaccount/api/v1/storage/core/users/?apikey={{api_key}}"

 payload = json.dumps({
          "tag": "uni4"
       })
  headers = {
 'Authorization': 'api_token',
 'Content-Type': 'application/json',
 }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)

Headers

Request Headers

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...

Response Headers:-

content-type: application/json; charset=utf-8
status: 202 Accepted

Body

Request Body-

{
  "bucket_name": "bucketname",
  "lifecycle_rules": [
      {
          "expiration_days": 1,
          "new_status": "Enabled",
          "noncurrent_version_expiration_date_or_days": 1,
          "prefix": "",
          "rule_id": 0
      }
  ]
}

Response Body

{
  "code": 200,
  "data": {
      "id": 6101,
      "my_account_id": null,
      "user_name": "{{username}}",
      "email": "",
      "access_key": "H334F1LDFXA6S5JGHI0I",
      "secret_key": "SQLYSI0KMWRULUTTRJI5E08EYYR519L3W5MABD26",
      "is_default": false,
      "disabled": false,
      "tag": "uni4"
  },
  "errors": {},
  "message": "Success"
}

Delete Access Key

To Delete a access key, send a Delete request-

https://api.e2enetworks.com/myaccount/api/v1/storage/core/users/?access_key={{access_key}}&apikey={{api_key}}

PYTHON

1. Python - http.client Example

import http.client

 conn = http.client.HTTPSConnection("api.e2enetworks.com")
 payload = ''
 headers = {
 'Authorization': 'api_token'
 }
 conn.request("DELETE", "/myaccount/api/v1/storage/core/users/?access_key={{access_key}}&apikey={{api_key}}",
 payload, headers)
 res = conn.getresponse()
 data = res.read()
 print(data.decode("utf-8"))
2. Python - Requests Example

 import requests

 url = "https://api.e2enetworks.com/myaccount/api/v1/storage/core/users/?access_key={{access_key}}&apikey={{api_key}}"

 payload={}
 headers = {
            'Authorization': 'api_token'
           }

  response = requests.request("DELETE", url, headers=headers, data=payload)

  print(response.text)

Headers

Request Headers

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...

Response Headers:-

content-type: application/json; charset=utf-8
status: 202 Accepted

Body

Response Body

{
  "code": 200,
  "data": {},
  "errors": "",
  "message": "The delete operation is successful"
}

Lock Access Key

To Lock a access key, send a Put request eos end point :-

https://api.e2enetworks.com/myaccount/api/v1/storage/core/users/?apikey={{api_key}}

Attributes and respective values required to send this POST request are:-

Name

Type

Description

Required

disabled

string

Provide disabled is true when you want to lock the access key

True

id

Integer

A unique integer identifier created and assigned to the bucket after its creation.

True

The request returns a JSON object that contains the following attributes:

Name

Type

Description

id

Integer

A unique integer identifier created and assigned to the bucket after its creation.

user_name

string

Show the name of the user.

tag

char

Char shows the name of the access key.

access_key

string

Unique identifier for the rule. The value can’t be longer than 255 characters.

secret_key

string

An unique identifier for the rule.

PYTHON

1. Python - http.client Example

 import http.client
 import json

 conn = http.client.HTTPSConnection("api.e2enetworks.com")
 payload = json.dumps({
 "disabled": True,
 "id": 6069
 })
 headers = {
 'Authorization': 'api_token',
 'Content-Type': 'application/json',
 }
 conn.request("PUT", "/myaccount/api/v1/storage/core/users/?apikey={{api_key}}", payload, headers)
 res = conn.getresponse()
 data = res.read()
 print(data.decode("utf-8"))
2. Python - Requests Example

  import requests
  import json

  url = "https://api.e2enetworks.com/myaccount/api/v1/storage/core/users/?apikey={{api_key}}"

  payload = json.dumps({
 "disabled": True,
 "id": 6069
 })
 headers = {
 'Authorization': 'api_token',
 'Content-Type': 'application/json',
 }

 response = requests.request("PUT", url, headers=headers, data=payload)

 print(response.text)

Headers

Request Headers

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...

Response Headers:-

content-type: application/json; charset=utf-8
status: 202 Accepted

Body

Request Body-

{
  "disabled": true,
  "id": 6069
}

Response Body

{
  "code": 200,
  "data": {
      "id": 6069,
      "my_account_id": null,
      "user_name": "{{username}}",
      "email": "",
      "access_key": "8UO5VD06ALNVOMPOL5Y7",
      "secret_key": null,
      "is_default": false,
      "disabled": true,
      "tag": "uni3"
  },
  "errors": null,
  "message": "Success"
}

Unlock Access Key

To Unlock a access key, send a Put request-

https://api.e2enetworks.com/myaccount/api/v1/storage/core/users/?apikey={{api_key}}

Attributes and respective values required to send this POST request are:

Name

Type

Description

Required

disabled

string

Provide disabled is true when you want to lock the access key

True

id

Integer

A unique integer identifier created and assigned to the bucket after its creation.

True

The request returns a JSON object that contains the following attributes:

PYTHON

1. Python - http.client Example

 import http.client
 import json

 conn = http.client.HTTPSConnection("api.e2enetworks.com")
 payload = json.dumps({
 "disabled": False,
 "id": 6069
 })
  headers = {
 'Authorization': 'api_token',
 'Content-Type': 'application/json',
 }
 conn.request("PUT", "/myaccount/api/v1/storage/core/users/?apikey={{api_key}}", payload, headers)
 res = conn.getresponse()
 data = res.read()
 print(data.decode("utf-8"))
2. Python - Requests Example

 import requests
 import json

 url = "https://api.e2enetworks.com/myaccount/api/v1/storage/core/users/?apikey={{api_key}}"

 payload = json.dumps({
 "disabled": False,
 "id": 6069
 })
 headers = {
 'Authorization': 'api_token',
 'Content-Type': 'application/json',
 }

 response = requests.request("PUT", url, headers=headers, data=payload)

 print(response.text)

Headers

Request Headers

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...

Response Headers:-

content-type: application/json; charset=utf-8
status: 202 Accepted

Body

Request Body-

{
  "disabled": false,
  "id": 6069
}

Response Body

{
  "code": 200,
  "data": {
      "id": 6069,
      "my_account_id": null,
      "user_name": "{{username}}",
      "email": "",
      "access_key": "8UO5VD06ALNVOMPOL5Y7",
      "secret_key": null,
      "is_default": false,
      "disabled": false,
      "tag": "uni3"
  },
  "errors": null,
  "message": "Success"
}

Attach Permission

To attach permission in the bucket , send a Put request-

https://api.e2enetworks.com/myaccount/api/v1/storage/bucket_perms/?apikey={{api_key}}&bucket_name={{nameofbucket}}

Attributes and respective values required to send this POST request are:

The request returns a JSON object that contains the following attributes:

Name

Type

Description

id

Integer

A unique integer identifier created and assigned to the bucket after its creation.

user_name

string

Show the name of the user.

tag

char

Char shows the name of the access key.

access_key

string

Unique identifier for the rule. The value can’t be longer than 255 characters.

secret_key

string

An unique identifier for the rule.

PYTHON

1. Python - http.client Example

 import http.client
 import json

 conn = http.client.HTTPSConnection("api.e2enetworks.com")
 payload = json.dumps({
 "role_name": "Bucket Admin",
 "users": [
   {
     "access_key": "L3A8MZCUORF0FYJ8GGCP",
     "disabled": False,
     "email": "",
     "id": 6068,
     "is_default": False,
     "my_account_id": None,
     "secret_key": None,
     "tag": "uni2",
     "user_name": "username"
   }
 ]
 })
   headers = {
     'Authorization': 'Bearer ',
     'Content-Type': 'application/json',
   }
  conn.request("PUT", "/myaccount/api/v1/storage/bucket_perms/?apikey={{api_key}}&bucket_name={{bucket}}", payload, headers)
  res = conn.getresponse()
  data = res.read()
  print(data.decode("utf-8"))
2. Python - Requests Example

 import requests
 import json

  url = "https://api.e2enetworks.com/myaccount/api/v1/storage/bucket_perms/?apikey={{api_key}}&bucket_name={{bucketname}}"

 payload = json.dumps({
 "role_name": "Bucket Admin",
 "users": [
   {
     "access_key": "L3A8MZCUORF0FYJ8GGCP",
     "disabled": False,
     "email": "",
     "id": 6068,
     "is_default": False,
     "my_account_id": None,
     "secret_key": None,
     "tag": "uni2",
     "user_name": "username"
   }
 ]
 })
  headers = {
     'Authorization': 'Bearer ',
       'Content-Type': 'application/json',
   }

  response = requests.request("PUT", url, headers=headers, data=payload)

 print(response.text)

Headers

Request Headers

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...

Response Headers:-

content-type: application/json; charset=utf-8
status: 202 Accepted

Body

Request Body-

{
  "role_name": "Bucket Admin",
  "users": [
      {
          "access_key": "L3A8MZCUORF0FYJ8GGCP",
          "disabled": false,
          "email": "",
          "id": 6068,
          "is_default": false,
          "my_account_id": null,
          "secret_key": null,
          "tag": "uni2",
          "user_name": "{{username}}"
      }
  ]
}

Response Body

{
  "code": 200,
  "data": [
      {
          "id": 2437,
          "user": {
              "id": 6068,
              "my_account_id": null,
              "user_name": "{{username}}",
              "email": "",
              "access_key": "L3A8MZCUORF0FYJ8GGCP",
              "secret_key": null,
              "is_default": false,
              "disabled": false,
              "tag": "uni2"
          },
          "role": {
              "id": 1,
              "name": "Bucket Admin",
              "display_name": "Bucket Admin",
              "active": true
          },
          "deleted": false,
          "created_at": "2022-04-21T05:57:48.121538Z",
          "updated_at": "2022-04-21T05:57:48.121633Z",
          "processed": true,
          "processed_on": null,
          "disabled": false,
          "date_disabled": null,
          "bucket": 2279
      }
  ],
  "errors": {},
  "message": "Success"
}

Delete Permission

To delete permission of the bucket, send a Delete request to the eos end point :-

https://api.e2enetworks.com/myaccount/api/v1/storage/bucket_perm/2437/?apikey={{api_key}}&bucket_name=bucket11

PYTHON

1. Python - http.client Example

 import http.client

  conn = http.client.HTTPSConnection("api.e2enetworks.com")
  payload = ''
  headers = {
      'Authorization': 'api_token',
  }
  conn.request("DELETE", "/myaccount/api/v1/storage/bucket_perm/2437/?apikey={{api_key}}&bucket_name={{bucket_name}}", payload, headers)
  res = conn.getresponse()
  data = res.read()
  print(data.decode("utf-8"))
2. Python - Requests Example

 import requests

 url = "https://api.e2enetworks.com/myaccount/api/v1/storage/bucket_perm/2437/?apikey={{api_key}}&bucket_name={{bucket_name}}"

 payload={}
 headers = {
 'Authorization': 'Api_token',
 }

 response = requests.request("DELETE", url, headers=headers, data=payload)

 print(response.text)

Headers

Request Headers

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...

Response Headers:-

content-type: application/json; charset=utf-8
status: 202 Accepted

Body

Response Body

{
  "code": 200,
  "data": {},
  "errors": {},
  "message": "Success"

}