How to migrate to V3 API

This document lists the changes that have been done in V3 API.



General differences between V2 and V3 APIs :

 

Change V2 V3 Comments

URL change 

/sdpapiv2

/api/v3

 

Access the mentioned URLs to make use of the different versions. Refer the changes made in URL for each module under their corresponding headings.

 

All the output fields will be string encoded except boolean. 

{

"id": 101,

"technician": {

"id": 8,

"name": "Howard Stern"

},

"inactive": false

}

{

"id": "101",

"technician": {

"id": "8",

"name": "Howard Stern"

},

"inactive": false

}

 

Note the format in which the output fields have been encoded in V3. "id"s provided in Integer format will now be string encoded in V3.

"associated_entity" and "associated_entity_id" have been replaced with parent entity object model.

{

"subentity":{

"associated_entity": "parent",

"associated_entity_id": "1"

}

}

 {

"subentity":{

"parent": {

"id": "1"

}

}

}

Refer changes done in Task and Worklog API for more details.

The position and structure of "fields_required" has been modified.

 {

"list_info":{

"fields_required":"[id,name,title]",

"row_count": "10",

"start_index": "1"

}

}

 {

"fields_required":[ "id", "name", "title"],

"list_info":{

"row_count": "10",

"start_index": "1"

}

}

"fields_required" should be used only for "Read" (GET and GET_ALL) operations.

 

"get_all" notation will not be supported in "fields_required" from V3.

{

  "list_info":{

    "fields_required":"[get_all]",

    "row_count": "10",

    "start_index": "1"

  }

{

"fields_required":[ //have to give the list of all attribute names instead of giving "get_all"//],

"list_info":{

"row_count": "10",

"start_index": "1"

}

}

In V2, "get_all" would fetch all the fields. In V3, "get_all" attributes will not be supported. Hence, the list of all the attribute names should be provided under "fields_required".

Behaviour of "fields_required" has been changed in V3.

 

For get and get_all : default fields + fields_required 

For get : default fields + fields_required

For get_all : fields_required alone

Previously, both get and "get_all" will provide all the default fields and fields required. Now, get will provide the same, while "get_all" will provide only the fields mentioned in the "fields_required".

 

"has_more_rows" will be available in "list_info" in  V3.

 

 {

"list_info":{

"has_more_rows" : true/false

}

}

 

"has_more_rows" indicates whether the entity has more data than the currently fetched set. For ex., if the user has given the row_count as 10 and the list contains more than 10 entries, then the "has_more_rows" will be true.

 

In "get_all" operation, the position if the filter attribute has been changed.

 {

"subentity":{

"filter": "OPEN"

"associated_entity":"parent",

"associated_entity_id": 1

},

"list_info":{

"start_index": 1,

"row_count": 10

}

}

{

"subentity":{

"parent": {

"id": "1"

}

},

"list_info":{

"start_index": "1",

"row_count": "10",

"filter": "OPEN"

}

 

The filter attribute, which was available inside the entity object in V2, has been moved to "list_info" in V3.

Consistent formatting of words in response messages

"Success", "Warning", "Info", "Failed", "statuscode" 

 "success", "warning", "info", "failed", "status_code"

Words starting with upper cases have been converted to lower cases. 

"id" will not be provided in the response status except for bulk operations 

 "response_status":{

"id": 1,

"status": "Success",

"messages":[]

}

"response_status":{

"status": "success",

"messages":[]

Henceforth, "id" will be mentioned in the response status only for bulk operations.

 

Date fields in input should be provided as json object

 {

"task": {

"scheduled_starttime": "1428477452973",

"scheduled_endtime": "14284778452500"

}

}

{

"task": {

"scheduled_start_time": {

"value":"1428477452973"

},

"scheduled_endtime": {

"value":"14284778452500"

}

}

}

 

Earlier, the date fields in input were provided as direct values. Now, the input for date fields will be provided as json object .

 

Changes in TASK API: 

Following Attribute name changes and structure changes have been added in V3.

Attribute name changes:

Below table lists the changes done in V3 with respect to Attribute names.

 

V2 V3

scheduled_starttime

scheduled_start_time

scheduled_endtime 

scheduled_end_time 

actual_starttime

actual_start_time 

actual_endtime

actual_end_time 



Removed attributes:

New attributes: 

overdue : Boolean value ( read-only )

email_before : given in milliseconds

The following format has been followed in order to mention the parent entity while adding a Task: 

"parent entity":

{

"id": "1"

where a parent entity should be a  project / milestone / request / change / problem. The same structure will be followed in output as well.

Structure Change :

Following structure change has been done for "comment" in V3.

 

V2 V3

"comment" : "Last added comment"

{

"comment": {

"id": "2",

"owner": {

"id": "3",

"name": "administrator"

},

"comment": "new comment"

}

}



Changes in WORKLOG API:

Removed attributes :

The following attributes have been removed in WORKLOG API.

New Attributes added:

The following format has been followed inorder to mention the parent entity while adding a Worklog : 

"parent entity":

{

"id": "1"

where the parent entity should be task / request / change / problem. The same structure will be followed in output as well.

URL change :

Refer the following URL change for the new form operation.

 

V2 V3

"/sdpapiv2/worklog/worklog_newform"

"/api/v3/worklog_newform"

 

Changes in ATTACHMENT API :

Attribute name changes : (only in output)

Few attribute names have been changed / replaced as follows in the output side of V3.

 

V2 V3

AttachmentName

file_name

AttachmentId

id

AttachmentSize

size

New Attribute : (only in output)  

"content_url" attribute has been added in V3.

 Example: "content_url": "/api/v3/attachments/3"


 

Changes in SOLUTION API:

"key_words" was returned as string in v2 get_all solution operation. In V3, it will be returned as a JSON array of string."

           
V2 V3

{

"solutions": [

{

"id": 3,

"title": "Modify Login screens and Logout screens",

"key_words": "[modify login screen, modify logout screen]"

}

]

}

{

"solutions": [

{

"id": 3,

"title": "Modify Login screens and Logout screens",

"key_words": [

"modify login screen",

"modify logout screen"

]

}

]