Data Sources Resource
Table of Contents
Get All Data Sources
Fetch all data sources for an organization.
Request
Method: GET
URL: https://api.ghostinspector.com/v1/organizations/{{organizationId}}/data-sources/?apiKey={{apiKey}}
Query parameters
apiKey
- Your API key provided in your account
{"code": "SUCCESS","data": [{"name": "My Data Source","organization": "5a1b419ae40144279f9ac680","data": [{"firstName": "Jim","lastName": "Brown","num": "2","square": "4"},{"firstName": "Bob","lastName": "Smith","num": "3","square": "9"},{"firstName": "Pat","lastName": "Jones","num": "4","square": "16"}],"_id": "f505a6a7c3f04ab2b5d6e990"},]}
Get Data Source
Fetch a specific data source for an organization.
Request
Method: GET
URL: https://api.ghostinspector.com/v1/organizations/{{organizationId}}/data-sources/{{dataSourceId}}/?apiKey={{apiKey}}
Query parameters
apiKey
- Your API key provided in your account
{"code": "SUCCESS","data": {"name": "My Data Source","organization": "5a1b419ae40144279f9ac680","data": [{"firstName": "Jim","lastName": "Brown","num": "2","square": "4"},{"firstName": "Bob","lastName": "Smith","num": "3","square": "9"},{"firstName": "Pat","lastName": "Jones","num": "4","square": "16"}],"_id": "f505a6a7c3f04ab2b5d6e990"}}
Create Data Source
Create a new data source for an organization.
Request
Method: POST
URL: https://api.ghostinspector.com/v1/organizations/{{organizationId}}/data-sources/?apiKey={{apiKey}}
Query parameters
apiKey
- Your API key provided in your account
organizationId
- The ID of the organization
Request Example using cURL
POST Request with JSON body
curl https://api.ghostinspector.com/v1/organizations/{{organizationId}}/data-sources/?apiKey={{apiKey}} \ -X POST \ -H "Content-Type: application/json" \ -d '{ "data": [ { "varOne": "valueOne" } ], "name": "dataSourceOne" }'
{"code": "SUCCESS","data": {"name": "dataSourceOne","organization": "5a1b419ae40144279f9ac680","data": [{"varOne": "valueOne"}],"_id": "d2594f57ec3e4567ac5c67fb"}}
Replace Data Source
Replace an existing data source for an organization.
Request
Method: POST
URL: https://api.ghostinspector.com/v1/organizations/{{organizationId}}/data-sources/{{dataSourceId}}/?apiKey={{apiKey}}
Query parameters
apiKey
- Your API key provided in your account
organizationId
- The ID of the organization
dataSourceId
- The ID of the data source to replace
Request Example using cURL
POST Request with JSON body
curl https://api.ghostinspector.com/v1/organizations/{{organizationId}}/data-sources/{{dataSourceId}}/?apiKey={{apiKey}} \ -X POST \ -H "Content-Type: application/json" \ -d '{ "name": "dataSourceOneChanged", "data": [ { "varOne": "valueOne" }, { "varOne": "valueTwo" } ] }'
{"code": "SUCCESS","data": {"name": "dataSourceOneChanged","organization": "5a1b419ae40144279f9ac680","data": [{"varOne": "valueOne"},{"varOne": "valueTwo"}],"_id": "d2594f57ec3e4567ac5c67fb"}}
Delete Data Source
Delete a specific data source for an organization.
Request
Method: DELETE
URL: https://api.ghostinspector.com/v1/organizations/{{organizationId}}/data-sources/{{dataSourceId}}/?apiKey={{apiKey}}
Query parameters
apiKey
- Your API key provided in your account
organizationId
- The ID of the organization
dataSourceId
- The ID of the data source to delete
{"code": "SUCCESS","data": true}