⚙️
API Reference
  • Introduction
  • Features
  • Roadmaps & Requests
  • Frequently Asked Questions
  • Release notes
  • 💡START HERE
    • Terminology
    • Identity and Access Management (IAM)
      • Overview
      • Users in IAM
      • Policies in IAM
      • Roles in IAM
      • Security best practices
    • Dynamic Objects
      • Object Definition
      • Field Definition
      • Data Validation
      • Data Security
        • Encryption
      • Version Control
      • Audit Logs
    • System Architecture Diagram
    • How-To Guides
      • Clinic Project
  • 🔌CORE API Reference
    • Overview
    • Auth
    • Projects
    • Organization
    • Users
    • Roles
    • Policies
    • Objects
    • Item
    • Files
    • Notifications
    • API Request History
    • Auto-Documentation
    • Branches & Merging
    • API Performance
  • ☁️[Coming SOON] YOUR ACCELERATOR PLATFORM ACCOUNT
    • Help and Support
    • Account Page
    • Billing
    • Upgrading an Instance
    • Adjust Server Performance
    • Custom Domain
    • Change Server Region
    • Manage Team
    • API Rate Limit
    • Developer API
  • 🔓SECURITY AND COMPLIANCE
    • Best Practices
    • SOC 2 Type 2 & SOC 3
    • GDPR
    • HIPAA
    • ISO 27001:2013
    • ISO 9001:2015
    • Penetration Testing
  • Accelerator Platform - Core APIs
  • Identity and Access Management
Powered by GitBook
On this page

Accelerator Platform - Core APIs

The Accelerator Platform Core APIs allow developers to quickly create databases (Organizations), relational tables called Objects, and CRUD API Endpoints with validation and business logic.

Authentication: To test the APIs described below, authentication as a Project Admin in the Accelerator Platform is required. Further information can be found in the Accelerator Platform IAM documentation.

Organizations: Within an Accelerator Platform project, it is possible to create multiple organizations, each of which represents a MongoDB database containing objects. By default, each organization includes two fields: name and domain. The organization metadata is stored in an Object called "Org", which can be extended with additional fields, similar to any other Object.

// Example 1:
    Step 1. Create a new Organization
    POST https://qa.accelerator-platform.com/api/v1/Organizations
    Request Header:
    {
        "Authorization": "bearer <Project-Admin-AuthToken>"
    }
    Request Body:
    {
    "name": "Clinic",
    "domain": "clinic"
    }
    Response Body:
  200
    <Organization-Id>
 400 
{ 
 "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1", 
 "title": "One or more validation errors occurred.", 
 "status": 400, 
 "traceId": "00-d8e7cef64a92d286849ae53583ab4775-c0cabf25d7ac41cb-00", 
 "errors": { ... } 
}
401 
Unauthorized
403
forbidden
    To Get the Organization
    Request Header:
    {  "Authorization": "bearer <Project-Admin-AuthToken>"  }
    GET https://qa.accelerator-platform.com/api/v1/GetOrganization/<Organization-Id>
    To Get all Organizations
    Request Header:
    {  "Authorization": "bearer <Project-Admin-AuthToken>"  }
    GET https://qa.accelerator-platform.com/api/v1/GetOrganizations

Objects: Object metadata is stored in a MongoDB collection called "objects" within the organization database. When creating an Object, users can add fields to the object, and define validation rules and business logic for each field. below is a list of all the attributes of an Object.

(Attributes that starts with underscore (_) are read-only and cannot be modified)

_id

ObjectId

This is the unique identifier of the object.

name

string

Every Object name is unique in an organization. It should be in the camelCase format. We can use this name to get data from the object.

containsUsers

boolean

This is an optional attribute. However, if the objective is to store additional user information in an Object, then this value must be set to true. This will allow the user to create an Item in the object in which the _id will be the same as the logged-in user, thereby enforcing a one-to-one relationship between the ‘users’ collection in the auth database and the item collection of the object.

enableVersionHistory

boolean

When this optional field is set to true, the system generates a read-only array field named '_versionHistory' and a read-only string field named '_version' within each item of the Object. The '_version' field begins with '1.0' and increments by 0.1 with each update made to the item. As a result, the previous version of the item is added to the '_versionHistory', allowing users to track the changes made to it.

fields

ObjectArray

"The 'fields' attribute is an array that contains the definitions for all the fields associated with an object. These fields have common attributes such as _id, name, label, type, and validators. The _id and name is unique within an Object. In the case of a choice field, an additional attribute called 'options' is included, which is a string array that lists all the available options. For reference fields, there is an attribute called 'lookup', which will be further explained in the following section where all the different types of fields will be discussed."

_createdAt

Date

This is the date and time when the object was created.

_createdBy

string

This is the email of the user who created the object

_modifiedAt

Date

This is the date and time when the object was last modified

_modifiedBy

string

This is the email of the user who last modified the object.

_collectionName

string

This is the name of the item collection where the object data is stored. The item collection follows a specific syntax: <first_8_characters_of_object_name>_<object_id>

Below is a comprehensive list of field types supported by the Accelerator Platform, along with the validators applicable to each field type. Note that the data type refers to the value type of the field.

Common Validators:

  1. isRequired: When set to true, this validator prohibits null or empty string values from being inserted or edited in the field of an object's item. This validator is applicable to all field types.

  2. isUnique: When set to true, the value of the field must be unique in the object's item collection. this validator is applicable for text, number, date, and email fields.

  3. regex: This validator is used to validate text and email fields using a regular expression.

text

string

isRequired,

isUnique,

regex,

minChars,

maxChars

To restrict the length of characters in a text field use ‘minChars’ and ‘maxChars’ validators.

Sample Field: {

"type": "text",

"name": "name",

"label": "Patient Name",

"validators": {

"isRequired": true,

"minChars": 3,

"maxChars": 50

}

}

number

integer/double

isRequired,

isUnique,

regex,

min,

max,

isInteger

The number field is capable of storing rational numbers. To only allow integers, set the 'isInteger' to true. To limit the range of values for the number field, use the 'min' and 'max' validators.

Sample Field:

{

"type": "number",

"name": "contactNo",

"label": "Patient Contact No",

"validators": {

"regex": "^[0-9]{10}$",

"isRequired": true

}

}

date

date

isRequired,

isUnique,

minDate,

maxDate

The date field accepts dates in a string format conforming to ISO 8601 standards. To define a date range, use the 'minDate' and 'maxDate' validators, which should be formatted in the same ISO 8601 format. Additionally, it is possible to set either value to 'Today' which will compare the date field value with the date and time when an item is being inserted or edited. For instance, if a date field stores a person's date and time of birth, the 'maxDate' validator can be set to 'Today' to ensure that the date and time of birth is not later than the date and time when the item is being inserted. Sample FIelds: {

"type": "date",

"name": "dob",

"label": "Date of Birth",

"validators": {

"isRequired": true,

"minDate": "1900-12-25",

"maxDate": "Today"

}

}

email

string

isRequired,

isUnique,

regex

Sample Field: {

"type": "email",

"name": "email",

"label": "Email",

"validators": {

"isRequired": true,

"isUnique": true,

"regex": "^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$"

}

}

choice

string

isRequired,

isSingleChoice

When there is a need to store a selection of values from a range of options, a choice field can be used. For all choice fields, it is mandatory to provide the 'options' attribute, which is an array of strings that contains all the available options. To insert multiple values into this field, use a comma-separated string format such as "option1, option2, option3". Additionally, it is possible to apply the ‘isSingleChoice’ validator to only allow one option to be selected.

Sample Field:

{

"type": "choice",

"name": "gender",

"label": "Gender",

"options": [ "Male", "Female" ],

"validators": {

"isRequired": true,

"IsSingleChoice": true

}

}

file

string

isRequired,

maxFileSize,

minFileSize allowedFileTypes

To insert an item that contains a file field, a two-step process is required. First, the file(s) must be uploaded using the UploadFiles API endpoint, which returns a list of IDs of the uploaded files. These IDs can then be used as the file field value when inserting an item. To limit the file size, validators such as "maxFileSize" and "minFileSize" can be used, which accept file sizes in the format of 100.0 KB, 1.0 MB, or 1.0 GB. It’s also possible to allow only a certain types of files using the “allowedFileTypes” validator, accept an array of file extensions

e. g. [ ".jpg", ".png", ".pdf" ].

Sample Field:

{

"type": "file",

"name": "profilePic",

"label": "Upload a Profile Picture",

"validators": {

"isRequired": true,

"minFileSize": "1.5 KB",

"maxFileSize": "1.5 MB",

"allowedFileTypes": [ "jpeg", "png", "jpg" ]

}

}

reference

string

isRequired

In the Accelerator Platform, a Reference field in an Object is capable of storing the '_id' of an Item from another Object within the same Organization. Whenever an Item with a reference field is retrieved, the '_id' allows the retrieval of additional information from the referenced Item. Therefore, the "lookup" attribute is mandatory for reference fields. This attribute is a JSON object that includes the "ObjectId" to hold the Id of the reference object and "returnedFields", an array of fields from the reference object that we want to retrieve when fetching the item. Sample Field:

{

"type": "reference",

"name": "provider",

"label": "Provider",

"validators": {

"isRequired": true

},

"lookup":{

"ObjectId": "<Providers-Object-Id>",

"returnedFields": [ "name", "email" ]

}

} Sample Item: {

"provider": "<Provider-Item-Id>" }

array

JSON Array

isRequired

This Field is used to store JSON Array

Sample Field: {

"type": "array",

"name": "symptoms",

"label": "Symptoms"

}

Sample Item: { "symptoms": [ "Fever", "Cough" ]

}

object

JSON Object

isRequired

This Field is used to store JSON Object Sample Field:

{

"type": "object",

"name": "address",

"label": "Address",

}

Sample Item: { "address": {

"addressLine": "Address Line ", city": "City", …

} }

Field Level Encryption: To encrypt a Field's value, set the "isEncrypted" attribute to true. This will store the value in an unreadable format

// Sample Field:
{
        "type": "number",
        "name": "ssn",
        "label": " Social Security number ",
        " isEncrypted ":  true,
        "validators": {    "isRequired": true  }
}

Example 2:

Use-case: To understand the functionalities of the Accelerator Platform, We will be implementing the following use case.

  1. We have a organization called Clinic.

  2. There are two type of user Providers and Patients.

  3. Providers can invite a Patients

  4. After Register and Login, users can insert and update their personal information.

  5. Providers can view only those Patients that they are associated with.

  6. Patients can view all the Providers in the Clinic.

In Example 1, we created the organization. Now we are ready to create the Objects

Step2. Create Provider Object

//   Request Header:
  {
    "Authorization": "bearer <Project-Admin-AuthToken>"
  }
  Request Body:
  {
    "name": "Providers",
    "containsUsers": true,
    "fields":[
      {
          "type": "text",
          "name": "name",
          "label": "Name",
          "validators": {
              "isRequired": true,
              "minChars": 3,
              "maxChars": 50
          }
      },
      {
          "type": "email",
          "name": "email",
          "label": "Email",
          "validators": {
            "isRequired": true,
            "isUnique": true,
            "regex": "^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$"
          }
      }
    ]
  }
  Response Body:
200
  <Providers-object-id>
400  
{  
 "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",  
 "title": "One or more validation errors occurred.",  
 "status": 400,  
 "traceId": "00-d8e7cef64a92d286849ae53583ab4775-c0cabf25d7ac41cb-00",  
 "errors": { ... }  
} 
401  
Unauthorized 
403 
Forbidden

Note that the containsUsers flag is set to true. Since Provider object will store Provider’s user information that may not be there in the users collection of the auth database.

//   Request Header:
  {
    "Authorization": "bearer <Project-Admin-AuthToken>"
  }
  Request Body:
  {
    "name": "Patients",
    "containsUsers": true,
    "fields":[
      {
          "type": "text",
          "name": "name",
          "label": "Name",
          "validators": {
              "isRequired": true,
              "minChars": 3,
              "maxChars": 50
          }
      },
      {
          "type": "email",
          "name": "email",
          "label": "Email",
          "validators": {
            "isRequired": true,
            "isUnique": true,
            "regex": "^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$"
          }
      },
      {
          "type": "reference",
          "name": "provider",
          "label": "Provider",
          "validators": {
              "isRequired": true
          },
          "lookup":{
              "ObjectId": "<Providers-object-Id>",
              "returnedFields": [
                  "name",
                  "email"
              ]
          }
      }
    ]
  }
  Response Body:
200
  <Patients-object-id>
400  
{  
 "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",  
 "title": "One or more validation errors occurred.",  
 "status": 400,  
 "traceId": "00-d8e7cef64a92d286849ae53583ab4775-c0cabf25d7ac41cb-00",  
 "errors": { ... }  
} 
401  
Unauthorized 
403 
Forbidden

Note: In the Patients object, there is a reference field.

Step 4. Add Items to Object: After the Provider Registration and Login we are ready to insert Item into the Provider Object

// Request Header:
{
  "Authorization": "bearer <Provider -AuthToken>"
}
Request Body:
[
  {
    "name": "Ajay", 
    "email": "provider.ajay@gmail.com"
  }
]
Response:
200
<n> of <n> items inserted successfully
400  
{  
 "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",  
 "title": "One or more validation errors occurred.",  
 "status": 400,  
 "traceId": "00-d8e7cef64a92d286849ae53583ab4775-c0cabf25d7ac41cb-00",  
 "errors": { ... }  
} 
401  
Unauthorized 
403 
Forbidden

Please note that to create an item, the Object's name is utilized in the request URL, and the JSON object of the item is constructed using the field names of the Object. As the AddItems API endpoint receives a list of items, the JSON object is enclosed within a JSON list.

// 
{
  "Authorization": "bearer <Provider -AuthToken>"
}

Step 6. In the same way add Patients

// Request Header:
{
  " Authorization ": "bearer <Patient-AuthToken>"
}
Request Body:
[
  {
    "name": "Lalit", 
    "email": "patient.lalit@gmail.com",
    "provider": "<provider-item-Id>"
  }
]
Response:
200
<n> of <n> items inserted successfully
400  
{  
 "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",  
 "title": "One or more validation errors occurred.",  
 "status": 400,  
 "traceId": "00-d8e7cef64a92d286849ae53583ab4775-c0cabf25d7ac41cb-00",  
 "errors": { ... }  
} 
401  
Unauthorized 
403 
Forbidden

Since the Patient Role has Policy that provide read access to “_id”, “name”, and “email” fields of all the Providers, You can get a <provider-item-id> by using the GetItems API endpoint with the Patient’s auth token

// Request Header:
{
  "Authorization": "bearer <Patient-AuthToken>"
}
Response:
200
<Json-list-of-providers>
400  
{  
 "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",  
 "title": "One or more validation errors occurred.",  
 "status": 400,  
 "traceId": "00-d8e7cef64a92d286849ae53583ab4775-c0cabf25d7ac41cb-00",  
 "errors": { ... }  
} 
401  
Unauthorized 
403 
Forbidden
// Request Header:
{
  "Authentication": "bearer <Patient-AuthToken>"
}
Response:
200
<Json-list-of-patients>
400  
{  
 "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",  
 "title": "One or more validation errors occurred.",  
 "status": 400,  
 "traceId": "00-d8e7cef64a92d286849ae53583ab4775-c0cabf25d7ac41cb-00",  
 "errors": { ... }  
} 
401  
Unauthorized 
403 
Forbidden

As there is a reference to providers in Patients, In the response the provider field of the items should include the _id, name, and email of the providers, where the _id matches the "<provider-item-Id>".

You can add more Providers and assign more Patients to them. Observe which Providers can access which Patients.

PreviousPenetration TestingNextIdentity and Access Management

Last updated 2 years ago

POST

Step 3. Create Patients Object POST

Once the Objects have been created, the next step is to invite Users and create Policies and Roles. For more information on this topic, you can refer to the Accelerator Platform IAM Documentation by clicking on the link .

POST

Step 5. Following is the request to get a list of all the Item GET

POST

GET

Following is the request to get a list of all the Patients POST

https://qa.accelerator-platform.com/api/v1/CreateObject
https://qa.accelerator-platform.com/api/v1/CreateObject
here
https://qa.accelerator-platform.com/api/v1/AddItems/Providers
https://qa.accelerator-platform.com/api/v1/GetItems/Providers
https://qa.accelerator-platform.com/api/v1/AddItems/Patients
https://qa.accelerator-platform.com/api/v1/GetItems/Providers
https://qa.accelerator-platform.com/api/v1/GetItems/Patients
https://app.accelerator-platform.com/SampleFields.jsonapp.accelerator-platform.com
To see a list of sample field objects
https://app.accelerator-platform.com/SampleItem.jsonapp.accelerator-platform.com
To see a list of sample item object