Skip to content

Latest commit

 

History

History
354 lines (273 loc) · 6.62 KB

api-organizations.adoc

File metadata and controls

354 lines (273 loc) · 6.62 KB
sidebar permalink summary
sidebar
api-organizations.html
How to use the Organizations API resource for the NKS API.

Organizations

Overview

Organizations are the highest-level resource. The Organizations resource contains information about the Organization. This includes the ID, which is required for most other API calls.

Background

The first time you log in to NKS, we automatically create an Organization for you. You can customize the name and logo of this Organization on the Organization Setup page.

GET All Organizations

Get the list of Organizations of which the user is a member.

GET https://api.nks.netapp.io/orgs/

Example request:

curl -X GET \
-H "Authorization: Bearer abcdef123456789abcdef123456789" \
"https://api.nks.netapp.io/orgs"

Example response:

[
  {
    "pk": 2,
    "name": "Company Organization",
    "slug": "company-organization",
    "logo": null,
    "created": "2018-09-24T18:23:22.889260Z",
    "updated": "2018-09-24T18:23:22.889291Z"
  },
  {
    "pk": 1,
    "name": "My Organization",
    "slug": "my-organization",
    "logo": null,
    "created": "2018-08-05T14:35:53.161852Z",
    "updated": "2019-01-31T18:31:21.583756Z"
  }
]

Return Values

Name Description

pk

Organization ID.

name

Organization name.

slug

A human-readable unique identifier, used for storing Organization data.

logo

Organization logo. This value is null if a custom logo has not been set.

created

Timestamp of the Organization’s create date.

updated

Timestamp of the last update to the Organization

GET a Specific Organization

Get information for a specific Organization.

Path Parameter

Name Required Description

Org ID

Yes

The Organization ID.

GET https://api.nks.netapp.io/orgs/{Org ID}

Example request:

curl -X GET \
-H "Authorization: Bearer abcdef123456789abcdef123456789" \
"https://api.nks.netapp.io/orgs/2"

Example response:

{
  "pk": 2,
  "name": "My Organization",
  "slug": "my-organization",
  "logo": null,
  "created": "2016-08-05T14:35:53.161852Z",
  "updated": "2019-01-31T18:31:21.583756Z"
}

Return Values

Name Description

pk

Organization ID.

name

Organization name.

slug

A human-readable unique identifier, used for storing Organization data.

logo

Organization logo. This value is null if a custom logo has not been set.

created

Timestamp of the Organization’s create date.

updated

Timestamp of the last update to the Organization

POST a New Organization

Create a new Organization in the user’s account.

POST https://api.nks.netapp.io/orgs/

Example Request:

curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer abcdef123456789abcdef123456789" \
-d @postorg.json \
"https://api.nks.netapp.io/orgs"

Contents of postorg.json:

{
  "name": "My New Organization"
}

Example Response. If the new Organization is created successfully, the API will return a list of all Organizations of which the user is a member, including the newly-created Organization. The new Organization is listed first.

[
 {
    "pk": 2,
    "name": "My New Organization",
    "slug": "my-new-organization",
    "logo": null,
    "created": "2019-01-31T20:32:01.041059Z",
    "updated": "2019-01-31T20:32:01.041093Z"
},
  {
    "pk": 1,
    "name": "My Organization",
    "slug": "my-organization",
    "logo": null,
    "created": "2018-08-05T14:35:53.161852Z",
    "updated": "2019-01-31T18:31:21.583756Z"
  }
]

Values

Name Required Description

name

Yes

Organization name.

Return Values

Name Description

pk

Organization ID.

name

Organization name.

slug

A human-readable unique identifier, used for storing Organization data.

logo

Organization logo. This value is null if a custom logo has not been set.

created

Timestamp of the Organization’s create date.

updated

Timestamp of the last update to the Organization

PATCH Update an Organization

Update information for an existing Organization.

Path Parameter

Name Required Description

Org ID

Yes

The Organization ID.

PATCH https://api.nks.netapp.io/orgs/{Org ID}

Example Request: Update the Organization name from the contents of a JSON file:

curl -X PATCH \
-H "Content-Type: application/json" \
-H "Authorization: Bearer abcdef123456789abcdef123456789" \
-d @postorg.json \
"https://api.nks.netapp.io/orgs/3"

Contents of postorg.json:

{
  "name": "New Organization Name"
}

Alternate example: Update the Organization name as form data:

curl -X PATCH \
-H "Content-Type: multipart/form-data" \
-H "Authorization: Bearer abcdef123456789abcdef123456789" \
-F name="New Organization Name" \
"https://api.nks.netapp.io/orgs/2"

Example Response

{
  "pk": 2,
  "name": "New Organization Name",
  "slug": "new-organization-name",
  "logo": null,
  "created": "2019-01-31T20:32:01.041059Z",
  "updated": "2019-01-31T21:21:07.607210Z"
}

Example request: Update the Organization logo as form data:

curl -X PATCH \
-H "Content-Type: multipart/form-data" \
-H "Authorization: Bearer abcdef123456789abcdef123456789" \
-F logo=@/path/to/file.jpg \
"https://api.nks.netapp.io/orgs/2"

Example response:

{
  "pk": 2,
  "name": "New Organization Name",
  "slug": "new-organization-name",
  "logo": "https:\/\/stackpoint_production.s3.amazonaws.com\/organization_logos\/logo.jpg",
  "created": "2016-08-05T14:35:53.161852Z",
  "updated": "2019-02-07T16:25:37.224597Z"
}

Values

Name Required Description

name

Yes

Organization name.

logo

No

Organization logo. This value is null if a custom logo has not been set. To set a custom logo, send it as content type multipart/form-data as shown above.

Return Values

Name Description

pk

Organization ID.

name

Organization name.

slug

A human-readable unique identifier, used for storing Organization data.

logo

Organization logo. This value is null if a custom logo has not been set.

created

Timestamp of the Organization’s create date.

updated

Timestamp of the last update to the Organization