Skip to content

Organizations

Organizations

Organizations are the top level organizational unit for the Rockfish Data Platform. It contains users, projects, and workers. New organizations can be created with the admin API.

Example

Create an Organization:

POST /organization HTTP/1.1
Content-Type: application/json
Host: localhost:8085

{
    "name": "internal"
}


HTTP/1.1 201 Created
Content-Type: application/json
Location: http://localhost:8085/organization/3p0LSgObZv9pU9t6wu14hf

{
    "id": "3p0LSgObZv9pU9t6wu14hf",
    "name": "internal",
    "self": "http://localhost:8085/organization/3p0LSgObZv9pU9t6wu14hf"
}

Create a User. When a new user is created an initial Token is also created and returned. This can be done by in the admin API with:

POST /user HTTP/1.1
Content-Type: application/json
Host: localhost:8085

{
    "email": "info@rockfish.ai"
}


HTTP/1.1 201 Created
Content-Type: application/json
Location: http://localhost:8085/user/7gKMTR8C71L7QIdCOK5vev

{
    "email": "info@rockfish.ai",
    "id": "7gKMTR8C71L7QIdCOK5vev",
    "self": "http://localhost:8085/user/7gKMTR8C71L7QIdCOK5vev"
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTIwMDc3MjQsImlzcyI6ImFwaSIsIm5iZiI6MTcxMjAwNzcyNCwidG9rZW5faWQiOiIzalBuOG1oNFp4dnM1TU9ZYzFLOHh2IiwidXNlcl9pZCI6IjlXS0R1U0tFaUdIbnRLTnZTZUQ4aiJ9.u2VhE4mLyNrr0g2cYd9CzWrfgdC1M6JloiomPP8inDM"
}

Alternatively, anyone can create a User in the public API if they know the invite code which is set in the configuration. This allows users to get their initial token without needing to to be passed along by an Admin:

POST /user?invite=aefah2Ef HTTP/1.1
Content-Type: application/json
Host: localhost:8080

{
    "email": "howdy@rockfish.ai"
}


HTTP/1.1 201 Created
Content-Type: application/json
Location: http://localhost:8080/user/YAjOuJZLv52CjlY9D136b

{
    "email": "howdy@rockfish.ai",
    "id": "YAjOuJZLv52CjlY9D136b",
    "self": "http://localhost:8080/user/YAjOuJZLv52CjlY9D136b",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MTIwMDcxODMsImlzcyI6ImFwaSIsIm5iZiI6MTcxMjAwNzE4MywidG9rZW5faWQiOiIzMUo4elE2cnNDYklJdTd3akFaVGllIiwidXNlcl9pZCI6IllBak91SlpMdjUyQ2psWTlEMTM2YiJ9.6GSWk5AtXK-Kzcv74ihio1mUs1SWQGJeEQGPZXVVINY"
}

Add the User to the Organization:

PUT /organization/12EKySxEscyI3fk0zswGkN/user/7gKMTR8C71L7QIdCOK5vev HTTP/1.1
Content-Type: application/json
Host: localhost:8085

{
    "roles": []
}

You can also add a User with an Admin role, these users can add additional users to the Organization and create Worker resources.

PUT /organization/12EKySxEscyI3fk0zswGkN/user/7gKMTR8C71L7QIdCOK5vev HTTP/1.1
Content-Type: application/json
Host: localhost:8085

{
    "roles": ["Admin"]
}



HTTP/1.1 204 No Content

This has created a default project:

GET /project HTTP/1.1
Host: localhost:8085



HTTP/1.1 200 OK
Content-Length: 245
Content-Type: application/json

[
    {
        "default": true,
        "id": "1sBR2VHrMLTe8s2VlPwJVm",
        "name": "Default Project",
        "owner": "http://localhost:8085/user/7gKMTR8C71L7QIdCOK5vev",
        "owner_id": "7gKMTR8C71L7QIdCOK5vev",
        "self": "http://localhost:8085/project/1sBR2VHrMLTe8s2VlPwJVm"
    }
]

You can create additional Tokens for the User:

POST /token HTTP/1.1
Host: localhost:8085
Content-Type: application/json

{
    "user": "http://localhost:8085/user/7gKMTR8C71L7QIdCOK5vev"
}


HTTP/1.1 201 Created
Content-Type: application/json
Location: http://localhost:8085/token/nPR6eEmv7NfRGCOwQYTtc

{
    "id": "nPR6eEmv7NfRGCOwQYTtc",
    "organization": "http://localhost:8085/organization/12EKySxEscyI3fk0zswGkN",
    "self": "http://localhost:8085/token/nPR6eEmv7NfRGCOwQYTtc",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MDg3MTQxOTgsImlzcyI6ImFwaSIsIm5iZiI6MTcwODcxNDE5OCwib3JnX2lkIjoiMTJFS3lTeEVzY3lJM2ZrMHpzd0drTiIsInRva2VuX2lkIjoiblBSNmVFbXY3TmZSR0NPd1FZVHRjIiwidXNlcl9pZCI6IjdnS01UUjhDNzFMN1FJZENPSzV2ZXYifQ.opWZu9BfEEksuAPgYHPkA5UU7oW0WMUvnIToYqofeB8",
    "user": "http://localhost:8085/user/7gKMTR8C71L7QIdCOK5vev"
}