Info
Created 12-02-2021 by Lavinia
Gheghea
Revision
Description
The API
allows you to create, delete,
and update sql job.
You can retrieve individual
sql job as well as a list
of all sql
jobs.
Endpoints
GET: /sqljobs
Parameters
Headers and Query
Name | Description | Type |
API-key - required | Authorization
Token | String(64) |
UID - required | UID -how can
be obtained | String |
DEVICEID - required | DEVICEID | String |
offset | starting record | Integer |
limit | how many records displayed
on a page | Integer |
OrderFieldName | field name to order the
recordset | String |
OrderDirection | ASC or DESC | String |
Filter | filter the recordset | String |
Curl example
curl -X GET "https://smartapi.smarttid.dk/sqljobs" -H "accept: */*" -H "UID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -H "DEVICEID:demo@smarttid.dk" -H "API-Key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Response
200 (OK) : array of sql
jobs
Response body
[{ "ID": 6, "SQLJobCode": "AKTIVEMEDARB", "Description": "alsdkj", "RecurrenceCode": "ALLEDAGE", "RunTime": "2020-07-15T06:00:00", "ExecuteEveryMin": null, "StartTime": null, "EndTime": null, "LastRunTime": "2021-02-12T06:00:00", "NextRunTime": "2021-02-13T06:00:00", "STATUS": "OK", "Active": true, "SendMailOnError": true, "SendMailOnSuccess": true, "MailTo": "", "SQLQuery": "DECLARE @dtDate DATETIME\r\nSET @dtDate = dbo.fDate(GETDATE())\r\nEXEC sp_InsertActiveEmployee @dtDate = @dtDate, @sMailTo = 'support@smarttid.dk'" }, { "ID": 8, "SQLJobCode": "UPDATEDB", "Description": "Automatisk update database to last version", "RecurrenceCode": "ALLEDAGE", "RunTime": "1900-01-01T00:00:00", "ExecuteEveryMin": 60, "StartTime": "1900-01-01T01:00:00", "EndTime": "1900-01-01T22:00:00", "LastRunTime": "2021-02-12T10:00:00", "NextRunTime": "2021-02-12T11:00:00", "STATUS": "OK", "Active": true, "SendMailOnError": true, "SendMailOnSuccess": false, "MailTo": "support@smarttid.dk", "SQLQuery": "EXEC sp_UpdateDB_TEST" }, ]
Response headers:
content-encoding: gzip content-length: 238 content-type: application/json; charset=utf-8 date: Mon, 24 Aug 2020 08:01:23 GMT server: Microsoft-IIS/10.0 vary: Accept-Encoding x-pagination: {"totalCount":4,"totalFiltered":4,"Offset":0,"Limit":4,"Returned":4} x-powered-by: ASP.NET
400 (ERROR) : Error
message
Response Body
Error message
GET{id} : /sqljobs/{id}
Parameters
Name | Description | Type |
API-key - required | Authorization
Token | String(64) |
UID - required | UID -how can
be obtained | String |
DEVICEID - required | DEVICEID | String |
id- required | ID of sql job | Integer |
Curl example
curl -X GET "https://smartapi.smarttid.dk/sqljobs/id" -H "accept: */*" -H "UID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -H "DEVICEID:demo@smarttid.dk" -H "API-Key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Response
200 (OK) : the sql job
Response Body
[{ "ID": 8, "SQLJobCode": "UPDATEDB", "Description": "Automatisk update database to last version", "RecurrenceCode": "ALLEDAGE", "RunTime": "1900-01-01T00:00:00", "ExecuteEveryMin": 60, "StartTime": "1900-01-01T01:00:00", "EndTime": "1900-01-01T22:00:00", "LastRunTime": "2021-02-12T10:00:00", "NextRunTime": "2021-02-12T11:00:00", "STATUS": "OK", "Active": true, "SendMailOnError": true, "SendMailOnSuccess": false, "MailTo": "support@smarttid.dk", "SQLQuery": "EXEC sp_UpdateDB_TEST" },]
Response Headers
content-encoding: gzip content-length: 175 content-type: application/json; charset=utf-8 date: Mon, 24 Aug 2020 08:39:57 GMT server: Microsoft-IIS/10.0 vary: Accept-Encoding x-powered-by: ASP.NET
400 (ERROR) : Error message
Response Body
Error message
POST: /sqljobs
Parameters
Name | Description | Type |
API-key - required | Authorization
Token | String(64) |
UID - required | UID -how can
be obtained | String |
DEVICEID - required | DEVICEID | String |
Request body
{ "sSQLJobCode": "string", "sDescription": "string", "sRecurrenceCode": "string", "dtRunTime": "string", "dtNextRunTime": "string", "bActive": true, "bSendMailOnError": true, "bSendMailOnSuccess": true, "sMailTo": "string", "sSQLQuery": "string", "dtStartTime": "string", "dtEndTime": "string", "nExecuteEveryMin": 0 }
Curl example
curl -X POST "https://smartapi.smarttid.dk/sqljobs" -H "accept: */*" -H "UID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -H "DEVICEID:demo@smarttid.dk" -H "API-Key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -H "Content-Type: application/json-patch+json" -d {\"sSQLJobCode\": \"string\", \"sDescription\": \"string\", \"sRecurrenceCode\": \"string\", \"dtRunTime\": \"string\", \"dtNextRunTime\": \"string\", \"bActive\": true, \"bSendMailOnError\": true, \"bSendMailOnSuccess\": true, \"sMailTo\": \"string\", \"sSQLQuery\": \"string\", \"dtStartTime\": \"string\", \"dtEndTime\": \"string\", \"nExecuteEveryMin\": 0}"
Response
200 (OK) : The ID of the new sql
job
Response Body
[ { "ID": 3 } ]
Response Headers
content-encoding: gzip content-length: 138 content-type: application/json; charset=utf-8 date: Mon, 24 Aug 2020 09:24:44 GMT server: Microsoft-IIS/10.0 vary: Accept-Encoding x-powered-by: ASP.NET
400 (ERROR) : Error message
Response Body
Error message
PUT{id}: /sqljobs/{id}
Parameters
Name | Description | Type |
API-key - required | Authorization
Token | String(64) |
UID - required | UID -how can
be obtained | String |
DEVICEID - required | DEVICEID | String |
id- required | ID of sql job | Integer |
Request body
{ "sSQLJobCode": "string", "sDescription": "string", "sRecurrenceCode": "string", "dtRunTime": "string", "dtNextRunTime": "string", "bActive": true, "bSendMailOnError": true, "bSendMailOnSuccess": true, "sMailTo": "string", "sSQLQuery": "string", "dtStartTime": "string", "dtEndTime": "string", "nExecuteEveryMin": 0 }
Curl example
curl -X PUT "https://smartapi.smarttid.dk/sqljobs/id" -H "accept: */*" -H "UID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -H "DEVICEID:demo@smarttid.dk" -H "API-Key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -H "Content-Type: application/json-patch+json" -d {\"sSQLJobCode\": \"string\", \"sDescription\": \"string\", \"sRecurrenceCode\": \"string\", \"dtRunTime\": \"string\", \"dtNextRunTime\": \"string\", \"bActive\": true, \"bSendMailOnError\": true, \"bSendMailOnSuccess\": true, \"sMailTo\": \"string\", \"sSQLQuery\": \"string\", \"dtStartTime\": \"string\", \"dtEndTime\": \"string\", \"nExecuteEveryMin\": 0}"
Response
200 (OK) : success
400 (ERROR) : Error message
Response Body
Error message
DELETE{id}: /sqljobs/{id}
Parameters
Name | Description | Type |
API-key - required | Authorization
Token | String(64) |
UID - required | UID -how can
be obtained | String |
DEVICEID - required | DEVICEID | String |
id- required | ID of sql job | Integer |
Curl example
curl -X DELETE "https://smartapi.smarttid.dk/sqljobs/id" -H "accept: */*" -H "UID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -H "DEVICEID:demo@smarttid.dk" -H "API-Key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Response
200 (OK) :Success
400 (ERROR) : Bad request
Response Body
Error message
Response headers
content-length: 84 content-type: text/plain; charset=utf-8 date: Tue, 25 Aug 2020 08:35:21 GMT server: Microsoft-IIS/10.0 x-powered-by: ASP.NET
Object
Sql Job
Name | Description | Type |
sSQLJobCode | Code of SQL Job | String |
sDescription | Description | String |
sRecurrenceCode | Recurrence Code | String |
dtRunTime | Run Time | String |
dtNextRunTime | Next Run Time | String |
bActive | Active | bool |
bSendMailOnError | Send Mail on Error | bool |
bSendMailOnSuccess | Send Mail On Success | bool |
sMailTo | Mail To | String |
sSQLQuery | SQL Query | String |
dtStartTime | Start Time | string |
dtEndTime | End Time | string |
nExecuteEveryMin | Execute Every Min | integer |