NAV
shell

Overview

API base url:

https://api.new.mapit.incommapps.com

A sample endpoint:

POST https://api.new.mapit.incommapps.com/users

curl "https://api.new.mapit.incommapps.com/users" \
-H "Authentication: Bearer <access-token>"

You should add a header Authentication to all requests after a user logs into an account. See an example of a CURL command.

Entity-relationship diagram

Alt text

Users

{
  "id": "15e45e32-cd4c-4671-86f5-4ee01b0e989f",
  "first_name": "Joe",
  "last_name": "Smith",
  "email": "joe.smith@example.com",
  "password": "Password123!"
}

Log in

# Request
{
  "email": "andrew.johns@gmail.com",
  "password": "Password123!"
}

# Response
{
  "id": "8ffd47dc-9231-45b3-8b47-7b5c34a16f65",
  "email": "andrew.johns@gmail.com",
  "first_name": "Andrew",
  "last_name": "Johns",
  "access_token": "eyJhbGciOiJIUzI1NiJ9.eyJ...extM"
}

POST /v1/login

Get current user

# Response
{
  "id": "8ffd47dc-9231-45b3-8b47-7b5c34a16f65",
  "email": "andrew.johns@gmail.com",
  "first_name": "Andrew",
  "last_name": "Johns",
}

GET /v1/user

Update current user

# Request

{
  "first_name": "Andrew",
  "last_name": "Johns",
  "email": "andrew.johns@gmail.com",
  "password": "Password123!"
}

# Response
{
  "id": "8ffd47dc-9231-45b3-8b47-7b5c34a16f65",
  "email": "andrew.johns@gmail.com",
  "first_name": "Andrew",
  "last_name": "Johns",
}

PATCH /v1/user

NOTE: any combination of the fields can be updated

Create a user

# Request
{
  "first_name": "Andrew",
  "last_name": "Johns",
  "email": "andrew.johns@gmail.com",
  "password": "Password123!"
}

# Response
{
  "id": "8ffd47dc-9231-45b3-8b47-7b5c34a16f65",
  "email": "andrew.johns@gmail.com",
  "first_name": "Andrew",
  "last_name": "Johns",
}

POST /v1/users

Get users

# Response
[
  {
    "id": "8ffd47dc-9231-45b3-8b47-7b5c34a16f65",
    "email": "andrew.johns@gmail.com",
    "first_name": "Andrew",
    "last_name": "Johns",
  },
  ...
]

GET /v1/users

Get a user by ID

# Response
{
  "id": "8ffd47dc-9231-45b3-8b47-7b5c34a16f65",
  "email": "andrew.johns@gmail.com",
  "first_name": "Andrew",
  "last_name": "Johns",
}

GET /v1/users/{id}

Update a user

# Request

{
  "first_name": "Andrew",
  "last_name": "Johns",
  "email": "andrew.johns@gmail.com",
  "password": "Password123!"
}

# Response
{
  "id": "8ffd47dc-9231-45b3-8b47-7b5c34a16f65",
  "email": "andrew.johns@gmail.com",
  "first_name": "Andrew",
  "last_name": "Johns",
}

PATCH /v1/users/{id}

NOTE: any combination of the fields can be updated

Delete a user

# Response
{
  "message": "User deleted."
}

DELETE /v1/users/{id}

Categories

Get categories

Response

{
  "id": 1818,
  "name": "Serhii_Merchant",
  "locations_count": 0,
  "updated_at": "2024-07-26 09:04:32",
  "updated_by": "John Smith",
  "icon_name": "small_red",
  "status": "new",
  "exception": false,
  "latest_upload": {},
  "category": {
    "id": 9,
    "name": "General"
  }
}

GET /v1/categories

Partners

Get Partners

GET /v1/partners

Array of partners

Get a Partner by ID

Response

{
  "id": 1818,
  "name": "Serhii_Merchant",
  "locations_count": 0,
  "updated_at": "2024-07-26 09:04:32",
  "updated_by": "John Smith",
  "icon_name": "small_red",
  "status": "new",
  "exception": false,
  "latest_upload": {},
  "category": {
    "id": 9,
    "name": "General"
  }
}

GET /v1/partners/{id}

Create a Partner

Request

{
  "name": "Example Partner",
  "updated_by": "user123",
  "exception": null,
  "category": [
    {
      "id": 1
    }
  ]
}

POST /v1/partners

Field Type Description
name string The name of the partner
updated_by string The user who updated the partner
exception string The exception of the partner
category array The category of the partner

Update a Partner

Request

{
  "name": "Example Partner",
  "updated_by": "user123",
  "exception": null,
  "category": [
    {
      "id": 1
    }
  ]
}

PUT /v1/partners/{id}

Delete a Partner

DELETE /v1/partners/{id}

Download Partners

GET /v1/partners/download

Merchants

Get Merchants

GET /v1/merchants

Array of merchants

Get a Merchant by ID

Response

{
  "id": 876,
  "name": "Serhii_Merchant",
  "locations_count": 2,
  "updated_at": "2024-07-16 13:50:00",
  "updated_by": "Developer On Duty",
  "icon_name": "small_orange",
  "status": "new",
  "limitation": "state",
  "exception": false,
  "latest_upload": {},
  "category": {
    "id": 3,
    "name": "Big Box"
  }
}

GET /v1/merchants/{id}

Create a Merchant

Request

{
  "name": "Example Merchant",
  "updated_by": "user123",
  "exception": null,
  "category": [
    {
      "id": 1
    }
  ]
}

POST /v1/merchants

Field Type Description
name string The name of the merchant
updated_by string The user who updated the merchant
exception string The exception of the merchant
category array The category of the merchant

Update a Merchant

Request

{
  "name": "Example Merchant",
  "updated_by": "user123",
  "exception": null,
  "category": [
    {
      "id": 1
    }
  ]
}

PUT /v1/merchants/{id}

Delete a Merchant

DELETE /v1/merchants/{id}

Download Merchants

GET /v1/merchants/download

Coverages

Get coverages

Request

{
  "partner_id": 1,
  "merchant_id": 1,
  "radius": 10
}

Response

{
  "percentage": 0,
  "partner_percentage": 0,
  "merchant_percentage": 0,
  "location_count": 0,
  "partner_location_count": 0,
  "merchant_location_count": 0,
  "state_coverages": [
    {
      "state_code": "MIDWEST",
      "percentage": 0,
      "mapped_location_count": 0,
      "state_location_count": 2
    }
  ],
  "region_coverages": [],
  "merchant": {
    "id": 876,
    "name": "Serhii_Merchant",
    "category_id": 3,
    "limitation": "state",
    "location_count": 2,
    "exception": false
  },
  "partner": {
    "id": 1814,
    "name": "PA - P66 Brands (SVS)",
    "category_id": 9,
    "location_count": 6674,
    "exception": false
  }
}

GET /v1/categories

Field Type Description
partner_id integer The ID of the partner
merchant_id integer The ID of the merchant
radius integer The radius of the coverage in miles

Uploads

Get all uploads

GET /v1/uploads

Field Type Description
partner_id integer The ID of the partner
- OR -
merchant_id integer The ID of the merchant

Array of uploads

Get an upload by ID

Response

{
  "id": 7706,
  "status": "processed",
  "uploaded_at": "2024-07-30 13:54:47",
  "uploaded_by": "Elizabeth Thornton",
  "processed_at": "2024-07-30 13:55:02",
  "location_count": 6674,
  "partner_id": 1814
}

GET /v1/uploads/{id}

Create an upload

POST /v1/uploads

Field Type Description
partner_id integer The ID of the partner
- OR -
merchant_id integer The ID of the merchant
keep_existing_locations boolean Whether to keep existing locations

Maps

Create a map

Response

{
  "id": 1
}

POST /v1/maps

Parameter Type Description
partner_id integer Partner ID
- OR -
merchant_id integer Merchant ID
radius integer Radius
limitation string Limitation
hide_partner_locations boolean Hide partner locations
hide_merchant_locations boolean Hide merchant locations
show_all_merchant_locations boolean Show all merchant locations
show_all_partner_locations boolean Show all partner locations
map_test_mode boolean Map test mode
merchants array Merchants
merchants[id] integer Merchant ID
merchants[marker] string Marker
merchants[states] array States
merchants[regions] array Regions
partners array Partners
partners[id] integer Partner ID
partners[marker] string Marker

Locations

Get all locations

GET /v1/locations

Parameter Type Description
parent_id integer The ID of the parent location.
- OR -
merchant_id integer The ID of the merchant.

Returns an xlsx file with all locations.

Reports

Get report

GET /v1/reports

For Partner:

Parameter Description Required
partner_id Partner ID Yes
merchant_ids Merchant IDs No
radius Radius Yes
category_id Category ID No
limitation Limitation No
states States No
regions Regions No

For Merchant: | Parameter | Description | Required | | --------- | ----------- | -------- | | merchant_id | Merchant ID | Yes | | partner_ids | Partner IDs | No | | radius | Radius | Yes | | category_id | Category ID | No | | limitation | Limitation | No | | states | States | No | | regions | Regions | No |

Returns an xlsx file with the report.