-
Notifications
You must be signed in to change notification settings - Fork 14
Create Application and Token
Matthew Villwock edited this page Feb 27, 2019
·
10 revisions
To enable API access to Shape, you need to create an Application and API token, and then link it to at least one Organization.
Create an Application:
application = Application.create(name: 'My App')
Create an API Token:
api_token = application.api_tokens.create
api_token.token
"f951ac89dd4a618cf86f1409a7f5c5ad7bcbecef"
If using the Shape Ruby SDK you can add the api token to your .env file:
SHAPE_API_TOKEN=f951ac89dd4a618cf86f1409a7f5c5ad7bcbecef
SHAPE_API_URL=https://www.shape.space/api/v1
To link an Application to an Organization so that it has access to that Organization's content, and creates a root collection for that application/organization:
organization = Organization.find(X)
application.application_organizations.create(organization: organization)
Add an external_id to the Organization if you want to filter by your ID when using the API:
organization.external_records.create(application: application, external_id: 'Your Org ID')
Note: Refer to the shape_external_id of your C∆ Organization for the above step.
See this page in the Creative Difference wiki page for how to do this process.