Krux Survey Tool API

Authorization

This API utilizes JSON Web Tokens (JWT) for authorization. The user will POST their username and password to the API’s login route. If the credentials are valid, the API will issue a JWT in the response body. The JWT must be passed as a value to a key named “x-access-token” in each subsequent call to the API. The key/value pair can be sent within the Header. The API will verify the token has not expired and will then extract the UserID within the token and add it as a parameter for accessing data. The JWT will expire after an hour of inactivity, at which point the user must repeat the authorization process to receive a new one.

AUTHORIZATION

Token: JWT<string>

Token

<token>

Application Program Interface (API)

1.1 Login POST

https://s-surveytoolapi.kruxanalytics.com/api/login

Used to authenticate user and obtain the JSON Web Token from the corresponding value of the “token” name in the JSON response. The token value must be present in the body or header of each subsequent API call.

BODY raw

{

"EmailAddress": “you@company.com” ,

"Password": “password123”

}

RESPONSE

{

"auth": true,

   "token": ${your token here},

   "id": ${your user ID here},

   "companyId": ${your company ID here}

}

1.2 Drills POST

https://s-surveytoolapi.kruxanalytics.com/api/drills

Used to obtain active Drills for the user’s organization.

*REQUIRED PARAMETERS

companyId: Integer

*OPTIONAL PARAMETERS

language: String

AUTHORIZATION

Token: JWT <string>

HEADERS

Authorization

x-access-token: <your_token>

RESPONSE

[

   {

       "DrillID": 9999,

       "DrillName": "Drill101"

   }

]

1.3 Holes POST

https://s-surveytoolapi.kruxanalytics.com/api/holes

Used to return a list of all active holes for a particular client.

*REQUIRED PARAMETERS

companyId: Integer

*OPTIONAL PARAMETERS

opertatorCompanyId: Integer
language: String

AUTHORIZATION

Token: JWT <string>

HEADERS

Authorization

x-access-token: <your_token>

RESPONSE

[

   {

       "ContractID": 27,

       "ContractName": "Acme 2020-04-23",

       "ProjectID": 74,

       "ProjectName": "Taylor",

       "HoleID": 7155,

       "HoleName": "RJS-20210531",

       "PlannedDepth": null,

       "PlannedDip": null,

       "PlannedAzimuth": null,

       "Latitude": 0,

       "HoleSpecifications": "Hole Specifications\nNew Comments"

   },

   {

       "ContractID": 27,

       "ContractName": "Acme 2020-04-23",

       "ProjectID": 74,

       "ProjectName": "Taylor",

       "HoleID": 7354,

       "HoleName": "RJS-20210805",

       "PlannedDepth": null,

       "PlannedDip": null,

       "PlannedAzimuth": null,

       "Latitude": 0,

       "HoleSpecifications": "Updated Hole Specifications\n8 August 2021\nNew Hole\nEspagnol\nFrançais\nPortuguês\nрусский\n\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"\n\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"\n\n\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"\n\n\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"\n\n\n\n"

   }

]

1.4 XML Submission POST

https://s-surveytoolapi.kruxanalytics.com/api/submitXML

Used to submit a survey data XML to the database.

AUTHORIZATION

Token: JWT <string>

HEADERS

Authorization

x-access-token: <your_token>

PREFLIGHT REQUEST(optional)

const xml = `${surveyXML}

const body = {

   "userId": 19,

   "xml": xml

}

pm.globals.set("body", JSON.stringify(body))

BODY raw

{

"userId": ${yourId},

"xml": ${yourXML}

}

If using pre-flight request

RESPONSE

{

"SurveyXMLID": 123456,

}

1.5 Check Token POST

https://s-surveytoolapi.kruxanalytics.com/api/check-token

Used to return a response as to whether the token included in the header remains valid.

HEADERS

Authorization

x-access-token: <your_token>

RESPONSE

{

   "valid": true,

   "message": "Your token is still valid"

}

OR

{

   "valid": false,

   "message": "Your token has expired"

}

OR

{

   "valid": false,

   "message": "An error occurred validating the status of your token"

}

1.6 Employees POST

https://s-surveytoolapi.kruxanalytics.com/api/employees

Used to obtain active employees for the user’s organization.

*REQUIRED PARAMETERS

companyId: Integer

*OPTIONAL PARAMETERS

userId: Integer

AUTHORIZATION

Token: JWT <string>

HEADERS

Authorization

x-access-token: <your_token>

RESPONSE

[

    {

        "EmployeeID": 1063,

        "FirstName": "Cornelius",

        "LastName": "Fudge a"

    },

    {

        "EmployeeID": 1613,

        "FirstName": "Hermoine",

        "LastName": "Granger"

    }

]