Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

This API will allow the use to query for header information on locations. The API can be called without passing a ID parameter in the

Authorization

The authorization will contain an API key and also will use an OAuth2 access token. An API key will be provided to each client that intends to consume this API. A development key and also a separate production key will be provided. If this key is not included then an authorization error will be returned.

The process for getting an OAuth2 token can be found here Authorization

Info

Scope Needed For This API - mi-cie.hub/read

 

Rest URL

The following are the URLs for this API.

Swagger Definitions

The following are the URLs for this API.

Headers

The following will be headers that will need to be supplied

Header

Description

x-api-key

This will be a key that will provided by a community information exchange administrator.

ContentType

application/json

Authorization

This will be the access token that was retrieved using your client id and secret

Request

Note that the person ID passed as a parameter in the URL as documented in the REST URL section.

Data Element

Description

Default

Path Parameter

id

This will be the service id of the requested record in the directory.

*Please note that this is only needed if you want to get a specific service payload for a ID.

 

Query String

query

A query parameter that will filter out the locations that will be returned. This is an json object and

The following lists commonly used query strings used for this API https://brightstreetgroup.atlassian.net/wiki/spaces/CIEP/pages/1576763393/services#Common-Queries

 

page

This will be which page of data that the user wants to be returned.

Default to Page 1

per_page

This will be the number of records that can be queried at a time. The maximum that can be queried is 100.

Default to 10

sort_by

field sort:
This will allow the data to be sorted by any root field.
examples: id, name, alternate_name, ect…

area sort:
An object can be passed in that will sort the locations by their distance from a reference area.
When the area sort is used an additional field will return in the locations object. field name: distance_miles
Examples of valid area sort objects:

Code Block
// Sort from given lat and long
{"lat":"45.8976","lng":"-84.89876"}

// Sort from the middle of a city
{"type":"city","name":"Grand Rapids"}

// Sort from the middle of a zipcode
{"type":"zipcode","name":"49505"}

 

order_by

ASC or DESC. ASC is default value

 

 

Response

The following will be the response values from the calling of the API. The error responses will conform ]to the following specification. https://tools.ietf.org/html/rfc7807 .

HTTP Status Code

Description

Response Example

200

Successful retrieval of a location record.

 

Code Block
[
  {
    "id": 970,
    "organization_id": 969,
    "organization_name": "CHILDREN'S ADVOCACY CENTER OF SOUTHWEST MICHIGAN",
    "source_id": 78174387,
    "source": "icarol",
    "name": "CHILDREN'S ADVOCACY CENTER OF SOUTHWEST MICHIGAN",
    "latitude": "42.0225356",
    "longitude": "86.4205098",
    "alternate_name": "BERRIEN COUNTY COUNCIL FOR CHILDREN, CHILDRENS ADVOCACY CENTER OF SOUTHWEST MICHIGAN",
    "schedule_notes": "Mon, Wed 9am-8pm; Tue, Thu-Fri 9am-5pm",
    "url": "www.swmichigancac.org",
    "description": "Located on Old US 31 near intersection of Marquette Woods Road and US-31",
    "accessibility_for_disabilities": null,
    "transportation": "No public transportation available",
    "region": "GRYP"
  }
]

 

403

Request is unauthorized and will not be processed. This will happen if the authorization header does not contain a valid client id and secret.

 

 

Code Block
{
  "message": "Forbidden"
}

 

 

400

Request is malformed and will not be processed.

 

Code Block
{
  "type": "cie-directory/validation-error",
  "title": "Invalid Parameter",
  "detail": "parameter per_page was greater then the max allowed for this endpoint. per_page: 10000 max_allowed: 100",
  "instance": "237869a1-67f0-4a68-9500-734b3956517b"
}

 

500

Internal Server Error

Code Block

  {
  "type": "cie-directory/unkown-error",
  "title": "There was an error retrieving the locations",
  "detail": "{\n\t\"stack\": \"Error: Error message\\n    at ServiceController.GetServicesAllComplete (/var/task/src/services/service-controller.js:214:13)\\n    at processTicksAndRejections (internal/process/task_queues.js:97:5)\\n    at async Runtime.exports.getServicesAllCompleteHandler [as handler] (/var/task/src/services/handler.js:73:22)\",\n\t\"message\": \"Error message\"\n}",
  "instance": "7a025b91-f1ff-4e4f-be75-42390fb02dd2"
}

 

Example CURL for this API Call

The following is an example CURL for calling this api.

Code Block
curl -v 
--request GET 'https://directory-uat.mi-cie.org/v1/locations/89' 
--header 'x-api-key: aGZoczo4****2ZDk=' 
--header 'Content-Type: application/json' 
--header 'Authorization: bearer etty****iquerui'