The MISS DIG Premium API provides a set of functions and procedures allowing the submitting of MISS DIG searches machine2machine. The MISS DIG API Premium will return a list of members who have an interest within the area of the submitted worksite. The worksite can take the form of either Well Known Text (WKT) or a centre point with radius combination.
Before you can use the API you will need to be granted access to the API. The steps below outline the process to gain access to the API
The Swagger UI is a description language for describing the MISS DIG APIs using JSON. The MISS DIG API Swagger UI can be accessed here .
You will see a list of API operations. The first required step is to create an access token which is passed to the API for all subsequent requests you make.
To submit a search in the MISS DIG API you must send an Authorisation token with each request. The first step in using the API is to create an API Access token. To create an Access token:
e.g.: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJod.......
Operation | Description | Notes |
---|---|---|
GetAccessToken | Provides access token (Bearer) to send with each subsequent api call in the authorization header | The token string must be passed with every API request |
GetEarliestDates | Provides the earliest dates allowed for enquiry start date and asset locate date based on the enquiry purpose | |
GetEnquiryPurposeList | Retrieves the full list of applicable Purposes | |
GetExcavationDepthList | Get excavation depth list | |
GetExcavationMethods | Get the full list of Excavation methods | |
GetProjections | Get list of all supported projections | |
GetPlanPaperSize | Gets the list of available paper sizes | Not required for MISS DIG requests |
GetPaperPlanScale | Get a list of all available paper plan map scales | Not required for MISS DIG requests |
GetWorkingOnBehalfOfAuthorityList | Get list working on behalf of authorities | |
GetWorkingOnBehalfOfList | Get list of working on behalf’s valid values | |
GetWorkplaceLocationList | Get all workplace locations | |
SubmitEnquiry | Submit a new enquiry |
The MISS DIG API requires that the user defines their worksite object in one of two ways; as a WKT or a Centre Point and Radius.
In the example below a WKT is used to describe a polygon (or circle) worksite. The MISS DIG API only supports POLYGON or LINESTRING objects. The coordinate system being employed in the WKT is also specified. In this case EPSG 4326. The full list of supported projections can be found in the GetProjections operation.
Further info on the WKT format can be found here .
There are additional fields for other regions that are not in use for MISS DIG.
The example below shows all the current fields that are in use.
Example JSON document with only MISS DIG required data:
{
"ActivityId": 182,
"AreaPreMarked": "No",
"CommencesOn": "2022-03-10T20:00:00-04:00",
"CompletesOn": "2022-03-12T20:00:00-04:00",
"CustomerMessage": "Sample message",
"ExcavationDepthId": 1,
"ExcavationMethodId": 1,
"ExcavatorDoingWork": "Onsite Contact Company (Excavator Doing Work)",
"InBodyOfWater": false,
"IsPrivateLocateRequired": false,
"LocationAddress": {
"Street": "Hickory St",
"Suburb": "Lansing"
},
"NearestCrossStreet": "S Pennsylvania Ave",
"PetOnProperty": false,
"PurposeId": 0,
"SpatialObjectCircleCenterX": "",
"SpatialObjectCircleCenterY": "",
"SpatialObjectCircleRadiusInFeet": 0,
"SpatialObjectDescription": "POLYGON((-84.53726791599208 42.72891415817745,-84.53726856162497 42.72891735540582,-84.53726963076895 42.72892049075251,-84.53727111312756 42.728923534022414,-84.53727299442482 42.728926455907214,-84.53727525654291 42.728929228267546,-84.53727787769634 42.728931824404086,-84.53728083264191 42.72893421931469,-84.53728409292198 42.72893638993504,-84.53728762713823 42.72893831536094,-84.5372914012542 42.72893997704949,-84.53729537892313 42.7289413589977,-84.53729952183787 42.72894244789673,-84.53730379009991 42.728943233259905,-84.5373081426035 42.72894370752371,-84.53731253743173 42.72894386612077,-84.53731693225994 42.72894370752371,-84.53732128476355 42.728943233259905,-84.5373255530256 42.72894244789673,-84.53732969594033 42.7289413589977,-84.53733367360927 42.72893997704949,-84.53733744772524 42.72893831536094,-84.53734098194148 42.72893638993504,-84.53734424222155 42.72893421931469,-84.53734719716712 42.728931824404086,-84.53734981832054 42.728929228267546,-84.53735208043864 42.728926455907214,-84.5373539617359 42.728923534022414,-84.53735544409449 42.72892049075251,-84.53735651323849 42.72891735540582,-84.53735715887139 42.72891415817745,-84.53735737477548 42.72891092985842,-84.53735715887139 42.728907701539235,-84.53735651323849 42.72890450431036,-84.53735544409449 42.72890136896286,-84.5373539617359 42.72889832569189,-84.53735208043864 42.72889540380579,-84.53734981832054 42.72889263144393,-84.53734719716712 42.72889003530571,-84.53734424222155 42.7288876403934,-84.53734098194148 42.72888546977137,-84.53733744772524 42.728883544343816,-84.53733367360927 42.72888188265376,-84.53732969594033 42.72888050070423,-84.5373255530256 42.72887941180411,-84.53732128476355 42.72887862644015,-84.53731693225994 42.72887815217583,-84.53731253743173 42.72887799357859,-84.5373081426035 42.72887815217583,-84.53730379009991 42.72887862644015,-84.53729952183787 42.72887941180411,-84.53729537892313 42.72888050070423,-84.5372914012542 42.72888188265376,-84.53728762713823 42.728883544343816,-84.53728409292198 42.72888546977137,-84.53728083264191 42.7288876403934,-84.53727787769634 42.72889003530571,-84.53727525654291 42.72889263144393,-84.53727299442482 42.72889540380579,-84.53727111312756 42.72889832569189,-84.53726963076895 42.72890136896286,-84.53726856162497 42.72890450431036,-84.53726791599208 42.728907701539235,-84.53726791599208 42.72891415817745))",
"SpatialObjectProjection": "EPSG:4326",
"WorkingOnBehalfOfAuthorityId": 0,
"WorkingOnBehalfOfId": 3,
"WorkplaceLocation": []
}
Field | Mandatory? | Notes | Example value |
---|---|---|---|
ActivityId | Y |
Values can be found in the GetEnquiryPurposeList operation. The ID is found as a child under the “Activities” and should not be confused with the Parent ID. For example, Activity ID: 62 reflects Job Purpose as 'Planned', Activity as 'Trenching' |
182 |
AreaPreMarked | Y | Description | "No" |
CommencesOn | Y | Work start date. Earliest dates can be retrieved from GetEarliestDates operation. Use ISO-8601 format | "2022-03-10T20:00:00-04:00" |
CompletesOn | Y | Work end date. Latest dates can be retrieved from GetEarliestDates operation. Use ISO-8601 format | "2022-03-12T20:00:00-04:00" |
ExcavationDepthId | Y | Description | 1 |
ExcavationMethodId | Y | Values can be found in the GetExcavationMethods operation. Enter the ID number for the selected Method | 1 |
ExcavatorDoingWork | Y | "Excavator Doing Work" | |
InBodyOfWater | Y | false | |
IsPrivateLocateRequired | Y | false | |
NearestCrossStreet | Y | "S Pennsylvania Ave" | |
PetOnProperty | Y | false | |
PurposeId | Y | Values can be found in the GetEnquiryPurposeList operation. Relates to the Parent ID. | 0 |
SpatialObjectDescription | Y (if using a WKT) | Enter the WKT value for the worksite and leave Centre Point and Radius values blank (for the section highlighted in green below). |
"LINESTRING (30 10, 10 30, 40 40)" "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))" |
Y (if using Centre Point and Radius) |
Leave blank for WKT value. Enter Centre Point and Radius values (for the section highlighted in green below). |
||
SpatialObjectCircleCenterX | Y | The longitude (X) value for the Centre Point | -84.537312 |
SpatialObjectCircleCenterY | Y | The latitude (Y) value for the Centre Point | 42.728910 |
SpatialObjectCircleRadiusInFeet | Y | The Radius of the circle. Minimum 41.0105ft, Maximum 1637.14ft | 25 |
SpatialObjectProjection | Y | The coordinate system used in the WKT or centre point. Supported projections can be retrieved from the GetProjections operation | "EPSG:4326" |
WorkingOnBehalfOfAuthorityId | Y | Values can be found in the GetWorkingOnBehalfOfAuthorityList Operation | 0 |
WorkingOnBehalfOfId | Y | Values can be found in the GetWorkingOnBehalfOfList Operation | 3 |
CustomerMessage | N | Description of onsite works and additional notes for asset owners. | "Sample message" |
LegalCommencement | N | Not required for MISS DIG. Can be removed from JSON. | "2022-03-10T20:00:00-08:00" |
"LocationAddress": { "Country": "", "State": "", "Postcode": "", "TownCity": "", "Suburb": "", "StreetType": "", "Street": "", "Number": "", "Prefix": "" } |
N | Only Suburb, Street, State or Region and Postcode should be populated for MISS DIG enquiries, the rest should be blank. Prefix Is optional |
"LocationAddress": { "Street": "Hickory St", "Suburb": "Lansing" } |
LotNoSubdivision | N | Not required for MISS DIG. Can be removed from JSON. | "12" |
PaperPlanScaleValue | N | Not required for MISS DIG. Can be removed from JSON. | |
PlanPaperSizeId | N | Not required for MISS DIG. Can be removed from JSON. | 1 |
PlansRequired | N | Not required for MISS DIG. Can be removed from JSON. | true |
PrincipalContactMobile | N | Not required for MISS DIG. Can be removed from JSON. | "123456789012345" |
PrincipalContactName | N | Not required for MISS DIG. Can be removed from JSON. | "Principal Contact Name" |
SecondNearestCrossStreet | N | Not required for MISS DIG. Can be removed from JSON. | "Jones St" |
UserReference | N | Your own reference for the enquiry | "User reference" |
AreaMarked | N | Not required for MISS DIG. Can be removed from JSON. | false |
AssetLocateOn | N | Not required for MISS DIG. Can be removed from JSON. | "2022-03-10T20:00:00-08:00" |
ExistingCarId | N | Not required for MISS DIG. Can be removed from JSON. | 20800 |
ExtensionData | N | Not required for MISS DIG. Can be removed from JSON. | |
ForceCreateCar | N | Not required for MISS DIG. Can be removed from JSON. | false |
LocationMunicipality | N | Not required for MISS DIG. Can be removed from JSON. | |
LocationNearestCommunity | N | Not required for MISS DIG. Can be removed from JSON. | |
LocationRuralSubdivision | N | Not required for MISS DIG. Can be removed from JSON. | |
OnsiteContactCompany | N | Not required for MISS DIG. Can be removed from JSON. | |
PrincipalContactDesignation | N | Not required for MISS DIG. Can be removed from JSON. | |
WorkplaceLocation | N | Not required for MISS DIG. Can be removed from JSON. |
"WorkplaceLocation": [ { "Code": "B", "LocationInRoad": [ "CarriageWay", "Berm" ] } ] |
The MISS DIG API requires that the user defines their worksite object in one of two ways; as a WKT or a Centre point and Radius.
In the example below a Centre Point and Radius is used to describe a circle worksite. The coordinate system being employed for the Centre point is also specified. In this case EPSG 4326. The full list of supported projections can be found in the GetProjections operation.
Example JSON document with Centre Point and Radius:
{ "ActivityId": 182, "AreaPreMarked": "No", "CommencesOn": "2022-03-10T20:00:00-04:00", "CompletesOn": "2022-03-12T20:00:00-04:00", "CustomerMessage": "Sample message", "ExcavationDepthId": 1, "ExcavationMethodId": 1, "ExcavatorDoingWork": "Onsite Contact Company (Excavator Doing Work)", "InBodyOfWater": false, "IsPrivateLocateRequired": false, "LocationAddress": { "Street": "Hickory St", "Suburb": "Lansing" }, "NearestCrossStreet": "S Pennsylvania Ave", "PetOnProperty": false, "PurposeId": 0, "SpatialObjectCircleCenterX": "-84.537312", "SpatialObjectCircleCenterY": "42.728910", "SpatialObjectCircleRadiusInFeet": 25, "SpatialObjectDescription": "", "SpatialObjectProjection": "EPSG:4326", "WorkingOnBehalfOfAuthorityId": 0, "WorkingOnBehalfOfId": 3, "WorkplaceLocation": [] }
The API results will be delivered in JSON format.
An example response is shown below:
{ "IsSuccess": true, "Message": null, "Results": [ { "Id": 0, "Exception": null, "Outcome": true, "Message": null } ], "JobLodgedDate": "2022-03-10T09:00:00-04:00", "TicketNumber": "2022030700003-000", "ConfirmedLocation": "-84.537312 42.728910", "notificationAddtionalInfo": [ { "StationCode": "10504", "UtilityId": 10504, "CompanyName": "MICHIGANTOWN SEWAGE UTILITY", "Industry": { "Code": "", "Value": "" }, "ContactNo": "1231561239", "EmergencyNo": "1231561239", "Status": "Notification Sent" }, { "StationCode": "MSUS2", "UtilityId": 10514, "CompanyName": "MICHIGANTOWN SEWAGE UTILITY STATION ANY", "Industry": { "Code": "", "Value": "" }, "ContactNo": "0414875458", "EmergencyNo": "0414875458", "Status": "Notification Sent" } ] }
Field | Notes | Example value |
---|---|---|
IsSuccess | If the submission was successful a true value will be shown otherwise it will be false |
true false |
Message | An error message if the submission was unsuccessful | |
Results | Further details on the success or failure of the job submission | |
JobLodgedDate | The date and time the job was submitted | "2022-03-10T09:00:00-04:00" |
TicketNumber | The MISS DIG job number reference | 2022030700003-000 |
ConfirmedLocation | System derived centre point of the enquiry object which was submitted | -84.537312 42.728910 |
notificationAddtionalInfo | Details of any MISS DIG members found to have an interest at the location of the search |
{ "StationCode": "MSUS2", "UtilityId": 10514, "CompanyName": "MICHIGANTOWN SEWAGE UTILITY STATION ANY", "Industry": { "Code": "", "Value": "" }, "ContactNo": "0414875458", "EmergencyNo": "0414875458", "Status": "Notification Sent" } |
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace InjectApiClient
{
public class InjectApiClientTest
{
public readonly string APIServerURL = "https://usonecall.peluat.net/Mobile/OneCall.MI-B4-EN";
public GetAccessTokenResponse Access { get; set; }
public async Task GetAccessToken()
{
Access = new GetAccessTokenResponse();
HttpClient client = new HttpClient();
StringContent httpContent = new StringContent(
@"{
'Username': 'ngenmissdiginternaluser',
'Password': 'ngenmissdiginternaluser'
}",
Encoding.UTF8,
"application/json"
);
var result = await client.PostAsync(APIServerURL + "/OneCallApi/GetAccessToken", httpContent);
var strResult = await result.Content.ReadAsStringAsync();
Access = Newtonsoft.Json.JsonConvert.DeserializeObject<GetAccessTokenResponse>(strResult);
}
public class GetAccessTokenResponse
{
public string Token { get; set; }
}
}
}
public async Task GetEarliestDates()
{
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + Access.Token);
var builder = new UriBuilder(APIServerURL + "/OneCallApi/GetEarliestDates");
var query = HttpUtility.ParseQueryString(builder.Query);
query["purposeId"] = "2"; // GET /OneCallApi/GetEnquiryPurposeList for valid purposeId
builder.Query = query.ToString();
string url = builder.ToString();
var result = await client.GetAsync(url);
var strResult = await result.Content.ReadAsStringAsync();
string jsonValue = JValue.Parse(strResult).ToString(Formatting.Indented);
}
public async Task GetEnquiryPurposeList()
{
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + Access.Token);
var result = await client.GetAsync(APIServerURL + "/OneCallApi/GetEnquiryPurposeList");
var strResult = await result.Content.ReadAsStringAsync();
string jsonValue = JValue.Parse(strResult).ToString(Formatting.Indented);
}
public async Task GetExcavationDepthList()
{
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + Access.Token);
var result = await client.GetAsync(APIServerURL + "/OneCallApi/GetExcavationDepthList");
var strResult = await result.Content.ReadAsStringAsync();
string jsonValue = JValue.Parse(strResult).ToString(Formatting.Indented);
}
public async Task GetExcavationMethods()
{
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + Access.Token);
var result = await client.GetAsync(APIServerURL + "/OneCallApi/GetExcavationMethods");
var strResult = await result.Content.ReadAsStringAsync();
string jsonValue = JValue.Parse(strResult).ToString(Formatting.Indented);
}
public async Task GetProjections()
{
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + Access.Token);
var result = await client.GetAsync(APIServerURL + "/OneCallApi/GetProjections");
var strResult = await result.Content.ReadAsStringAsync();
string jsonValue = JValue.Parse(strResult).ToString(Formatting.Indented);
}
public async Task GetPlanPaperSize()
{
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + Access.Token);
var result = await client.GetAsync(APIServerURL + "/OneCallApi/GetPlanPaperSize");
var strResult = await result.Content.ReadAsStringAsync();
string jsonValue = JValue.Parse(strResult).ToString(Formatting.Indented);
}
public async Task GetPaperPlanScale()
{
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + Access.Token);
var result = await client.GetAsync(APIServerURL + "/OneCallApi/GetPaperPlanScale");
var strResult = await result.Content.ReadAsStringAsync();
string jsonValue = JValue.Parse(strResult).ToString(Formatting.Indented);
}
public async Task GetWorkingOnBehalfOfAuthorityList()
{
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + Access.Token);
var builder = new UriBuilder(APIServerURL + "/OneCallApi/GetWorkingOnBehalfOfAuthorityList");
var query = HttpUtility.ParseQueryString(builder.Query);
query["workingOnBehalfOfID"] = "2"; // GET /OneCallApi/GetWorkingOnBehalfOfList for valid workingOnBehalfOfID
builder.Query = query.ToString();
string url = builder.ToString();
var result = await client.GetAsync(url);
var strResult = await result.Content.ReadAsStringAsync();
string jsonValue = JValue.Parse(strResult).ToString(Formatting.Indented);
}
public async Task GetWorkingOnBehalfOfList()
{
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + Access.Token);
var result = await client.GetAsync(APIServerURL + "/OneCallApi/GetWorkingOnBehalfOfList");
var strResult = await result.Content.ReadAsStringAsync();
string jsonValue = JValue.Parse(strResult).ToString(Formatting.Indented);
}
public async Task GetWorkplaceLocationList()
{
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + Access.Token);
var result = await client.GetAsync(APIServerURL + "/OneCallApi/GetWorkplaceLocationList");
var strResult = await result.Content.ReadAsStringAsync();
string jsonValue = JValue.Parse(strResult).ToString(Formatting.Indented);
}
public async Task SubmitEnquiry()
{
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + Access.Token);
StringContent httpContent = new StringContent(
@"{
'ActivityId': 182,
'AreaPreMarked': 'No',
'CommencesOn': '2022-03-24T11:00:00-04:00',
'CompletesOn': '2022-03-27T11:00:00-04:00',
'CustomerMessage': 'Sample message',
'ExcavationDepthId': 1,
'ExcavationMethodId': 1,
'ExcavatorDoingWork': 'Onsite Contact Company (Excavator Doing Work)',
'InBodyOfWater': false,
'IsPrivateLocateRequired': false,
'LocationAddress': {
'Street': 'Hickory St',
'Suburb': 'Lansing'
},
'NearestCrossStreet': 'S Pennsylvania Ave',
'PetOnProperty': false,
'PurposeId': 0,
'SpatialObjectCircleCenterX': '-84.537312',
'SpatialObjectCircleCenterY': '42.728910',
'SpatialObjectCircleRadiusInFeet': 25,
'SpatialObjectDescription': '',
'SpatialObjectProjection': 'EPSG:4326',
'WorkingOnBehalfOfAuthorityId': 0,
'WorkingOnBehalfOfId': 3,
'WorkplaceLocation': []
}",
Encoding.UTF8,
"application/json"
);
var result = await client.PostAsync(APIServerURL + "/OneCallApi/SubmitEnquiry", httpContent);
var strResult = await result.Content.ReadAsStringAsync();
string jsonValue = JValue.Parse(strResult).ToString(Formatting.Indented);
}