03 - Required API Operations

03 - Required API Operations

Each data type that Universal Migrator will load to your system must support four operations:
  1. Create
  2. Search (list)
  3. Sparse Update
  4. Delete

All Four Operations are Required

Before our team can write the code to push a data type to your application, your API must support all four operations for that data type.

Required Operations

Create

This operation will be used to create new records in your system.  The invocation for Create should be something like this:

  1. POST /api/v1/contacts/create

  2.    “data”: { 
  3.      “type”: “person”, 
  4.      “first_name”: “John”, 
  5.      “last_name”: “Smith” 
  6.    } 


On success, it should return JSON bodies similar to this:


  1.    “data”: { 
  2.      “id”: “12345”, 
  3.      “type”: “person”, 
  4.      “first_name”: “John”, 
  5.      “last_name”: “Smith”, 
  6.      “created_at”: “2017-05-11T16:28:24-05:00”, 
  7.      “updated_at”: “2017-05-11T16:28:24-05:00”, 
  8.    }


On error, it should return JSON bodies similar to this:

  1.    “error”: { 
  2.      “type”: “validation_exception”, 
  3.      “message”: “something went wrong” 
  4.    } 



Search (List)

This operation will be used to find, filter, and/or page through records that have already been created.  The invocation for Search should be something like this:


  1. POST /api/v1/contacts/search
  2.    "filter": { 
  3.      "ids": [ "12345", "12346", "12347"], 
  4.      "type": "person", 
  5.      "created_after": "2017-05-11T16:28:24-05:00", 
  6.      "updated_after": "2017-05-11T16:28:24-05:00", 
  7.      "skip": 1000, 
  8.      "take": 50
  9.    } 

On success, it should return JSON bodies similar to this:


  1.    “data”: [
  2.       { 
  3.        “id”: “12345”, 
  4.        “type”: “person”, 
  5.        “first_name”: “John”, 
  6.        “last_name”: “Smith”, 
  7.        “created_at”: “2017-05-11T16:28:24-05:00”, 
  8.        “updated_at”: “2017-05-11T16:28:24-05:00”, 
  9.      },
  10.       { 
  11.        “id”: “12346”, 
  12.        “type”: “person”, 
  13.        “first_name”: “Jane”, 
  14.        “last_name”: “Doe”, 
  15.        “created_at”: “2017-05-11T16:28:24-05:00”, 
  16.        “updated_at”: “2017-05-11T16:28:24-05:00”, 
  17.      },
  18.     ]


On error, it should return JSON bodies similar to this:

  1.    “error”: { 
  2.      “type”: “validation_exception”, 
  3.      “message”: “something went wrong” 
  4.    } 



The Search API must support the following filters:
id_before
id_after

The Search API must support ordering items by Id.

Sparse Update

Info
A sparse update is an update API that only updates the provided fields and does not change any other fields.
 
This operation will be used to find records that have already been created.  The URL for Sparse Update should be something like this:

  1. PATCH /api/v1/contacts/12345
  2.    “data”: { 
  3.      “last_name”: “doe” 
  4.    } 


The responses should be identical to that of the Create operation.

Delete

This operation will be used to delete records that have already been created.  The URL for Delete should be something like this:

  1. DELETE /api/v1/contacts/12345



On success, it should return JSON bodies similar to this:


  1.    “status”: { 
  2.      “type”: “record_deleted”, 
  3.      “message”: “The record was successfully deleted”
  4.    }


On error, it should return JSON bodies similar to this:

  1.    “error”: { 
  2.      “type”: “validation_exception”, 
  3.      “message”: “something went wrong” 
  4.    } 



Other Requirements

Your API should have an endpoint which can identify the currently authenticated user.  Something like:
/api/v1/users/who_am_i

    • Related Articles

    • Push Connector Requirements.

      Universal Migrator facilitates migrations between hundreds of different applications into destination applications whom we have built a push connector for. If you are reading this article, you likely want Universal Migrator to load data into your ...
    • 01 - Allowing Universal Migrator to Authenticate with your API

      In order for Universal Migrator to push data to your system, you should select one of the authentication methods below. Option 1: OAuth2 Authentication (Recommended) If using this method, you should provision Universal Migrator as an OAUTH2 ...
    • 05 - Patterns to Implement & Avoid

      When you're building your API, you should avoid falling into the following traps: Patterns to Avoid These are patterns that you should avoid. Avoid Non-JSON Requests/Responses Your API should only accept JSON requests and only respond with JSON ...
    • Installing Unstoppable Copier

      Installing Roadkil’s Unstoppable Copier Roadkil’s Unstoppable Copier is a lightweight, free utility that allows you to recover files from disks with physical damage or read errors. It can also be used as a simple file backup tool, automating copy ...
    • 04 - Preserving Important Metadata

      Author/Editor information (along with created/modified timestamps) are very important to many law firms. When Universal Migrator pushes data to your API, it has the ability to push associated metadata if your API accepts it. We recommend that all ...