Projects and Applications

In this section we will create a Platform project and application to help scope and model the data and access for this scenario. The project will contain all the resources relevant to this API walkthrough, whereas the application will represent a web app that will provide the product scanning experience, and allow creation of Application Users who will be performing the actual product scans.


## Creating a Project

A project is the top-most level of scoping in an EVRYTHNG account. By scoping individual resources to different projects, you can control who has access to them, separate concerns, and easily view only resources that are relevant to the project.

To create your first project, make a POST /projects request as shown below:

📘

Note

If you are using cURL and have not exported OPERATOR_API_KEY, remember to replace this manually in the subsequent examples.

curl -H "Content-Type: application/json" \
  -H "Authorization: $OPERATOR_API_KEY" \
  -X POST 'https://api.evrythng.io/v2/projects' \
  -d '{
    "name": "Consumer Engagement Project",
    "description": "A project for all the Consumer Engagement resources.",
    "tags": ["Consumer Engagement"]
  }'
HTTP/1.1 201 Created
Content-Type: application/json

{
  "id": "UGhQAe3eeXswQ5wwagWUNKaq",
  "createdAt": 1501508756298,
  "tags": [
    "Consumer Engagement"
  ],
  "updatedAt": 1501508756298,
  "name": "Consumer Engagement Project",
  "description": "A project for all the Consumer Engagement resources.",
  "shortDomains": [
    "tn.gg"
  ]
}

The response will contain an id field, which is the project’s unique identifier. Make a note of this now for use in the rest of this walkthrough. To read it again in the future, make a GET /projects request at any time using your Operator API Key in the same manner.

With this newly created project we can correctly scope future resources created in this walkthrough to keep them tidily in one place. This is usually done by including the project query parameter, as you will see in the upcoming examples.


## Creating an Application

Every project in the Platform, such as the one you just created, can contain one or more application resources. Whereas a project resource helps scope resources, applications help manage access to resources. For example, access can be given to individual Application Users, who on each login are each given their own Application User API Key with access to only those resources in the project they are scoped to.

The application resource itself is most commonly used to model the interactions with the Platform resources through a client mobile/web application, and contains a special Application API Key to let the third-party app make requests with the right level of access. You will obtain one of these below.

Creating an application through the API is done by making a POST /projects/:projectId/applications request, which requires the ID of the project the application will belong to. Use the noted ID from the POST /projects response, or make a GET /projects request to find it again.

Substitutions: :projectId

curl -H "Content-Type: application/json" \
  -H "Authorization: $OPERATOR_API_KEY" \
  -X POST 'https://api.evrythng.io/v2/projects/:projectId/applications' \
  -d '{
    "name": "Scanning Web App",
    "description": "A web app to scan products.",
    "socialNetworks": {}
  }'
HTTP/1.1 201 Created
Content-Type: application/json

{
  "id": "UGE9dWaxBXsRtKRwaDdWnepa",
  "createdAt": 1501508865613,
  "updatedAt": 1501508865613,
  "name": "Scanning Web App",
  "description": "A web app to scan products.",
  "project": "UGhQAe3eeXswQ5wwagWUNKaq",
  "socialNetworks": {},
  "appApiKey": "ejj05OmVhXbfPHzgg...",
  "defaultRole": "base_app_user"
}

Make a note of the appApiKey value - this is the application’s Application API Key, and is used to allow mobile or web applications to interact with the Platform resources, as well as to create and manage Application Users. These users will be the ones creating and managing their own resources such as actions representing product scans. We will cover all this in the next sections.


What’s Next