Breakpoints Resource (Debugger API 2.0)

Summary

Http Method Resource Description
GET /breakpoints Returns all breakpoints currently set in the debugger.
POST /breakpoints Sets all breakpoints in the specified Breakpoints instance.
DELETE /breakpoints Removes all the breakpoints from the debugger.
GET /breakpoints/{breakpoint_id} Gets a breakpoint. If the breakpoint cannot be located, this action throws a BreakpointNotFoundException.
DELETE /breakpoints/{breakpoint_id} Deletes the breakpoint. If the breakpoint cannot be located, this action throws a BreakpointNotFoundException.

Get Breakpoints

Returns all breakpoints currently set in the debugger.

Url

GET http://hostname:port/dw/debugger/v2_0/breakpoints

Formats

json, xml

Authentication

Name Description
None No authentication.

Response Document

Breakpoints

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 ClientIdRequiredException   Indicates that the request did not contain a client identifier.
401 NotAuthorizedException   Indicates that the specified user is not authorized.
412 DebuggerDisabledException   Indicates that the Client resource has not been created.

Sample

REQUEST:
GET /s/-/dw/debugger/v1_0/breakpoints HTTP/1.1
Authorization: Basic YWRtaW46RGVtYW5kd2FyZTEh
x-dw-client-id: DebuggerTest
Content-Type: application/json
Content-Length: 0

in case of success:

RESPONSE:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
  "_v":"2.0",
  "breakpoints":
  [
    {
      "id":1,
      "line_number":25,
      "script_path":"/app_storefront_controllers/cartridge/controllers/Cart.js"
    }
  ]
}

in case of authorization error:

RESPONSE:
HTTP/1.1 401 Unauthorized
Content-Type: application/json;charset=UTF-8
{
  "_v":"2.0",
  "fault":
    {
      "type":"NotAuthorizedException",
      "message":"You are not authorized to use the Script Debugger."
    }
}

# in case of identification failure:

RESPONSE
HTTP/1.1 400 Bad Request
Content-Type: application/json;charset=UTF-8
{
  "_v":"2.0",
  "fault":
  {
    "type":"ClientIdRequiredException",
    "message":"You must have a client identifier in the request header using the key 'x-dw-client-id'."
  }
}

Create Breakpoints

Sets all breakpoints in the specified Breakpoints instance.

Url

POST http://hostname:port/dw/debugger/v2_0/breakpoints

Formats

json, xml

Authentication

Name Description
None No authentication.

Request Document

Breakpoints

Response Document

Breakpoints

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 ClientIdRequiredException   Indicates that the request did not contain a client identifier.
400 InvalidScriptPathException   Indicates that the script path is not valid.
400 InvalidScriptFileException   Indicates that the script file is not valid.
401 NotAuthorizedException   Indicates that the specified user is not authorized.
412 DebuggerDisabledException   Indicates that the Client resource has not been created.

Sample

REQUEST:
POST /s/-/dw/debugger/v1_0/breakpoints HTTP/1.1
Authorization: Basic YWRtaW46RGVtYW5kd2FyZTEh
x-dw-client-id: DebuggerTest
Content-Type: application/json
{
  "_v":"2.0",
  "breakpoints":
    [
      {"line_number":20,"script_path":"/app_storefront_controllers/cartridge/controllers/Cart.js"},
      {"line_number":25,"script_path":"/app_storefront_controllers/cartridge/scripts/models/CartModel.js"}
    ]
}

REQUEST:
POST /s/-/dw/debugger/v1_0/breakpoints HTTP/1.1
Authorization: Basic YWRtaW46RGVtYW5kd2FyZTEh
x-dw-client-id: DebuggerTest
Content-Type: application/json
{
  "_v":"2.0",
  "breakpoints":
    [
      {"condition":"product.isOnline() == true", "line_number":20,"script_path":"/app_storefront_controllers/cartridge/controllers/Cart.js"},
      {"condition":"product.isOnline() == true", "line_number":25,"script_path":"/app_storefront_controllers/cartridge/scripts/models/CartModel.js"}
    ]
}

 
# in case of success:
 
RESPONSE:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
  "_v":"2.0",
  "breakpoints":
    [
      {"id":1, "line_number":20,"script_path":"/app_storefront_controllers/cartridge/controllers/Cart.js"},
      {"id":2, "line_number":25,"script_path":"/app_storefront_controllers/cartridge/scripts/models/CartModel.js"}
    ]
} 

# in case of success with condition:

RESPONSE:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
  "_v":"2.0",
  "breakpoints":
    [
      {"condition":"product.isOnline() == true", "id":1, "line_number":20,"script_path":"/app_storefront_controllers/cartridge/controllers/Cart.js"},
      {"condition":"product.isOnline() == true", "id":2, "line_number":25,"script_path":"/app_storefront_controllers/cartridge/scripts/models/CartModel.js"}
    ]
} 

# in case of failures:

RESPONSE:
HTTP/1.1 400 BAD REQUEST
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"2.0",
  "type":"InvalidScriptFileException",
  "message":"Script Path must be a JavaScript file with a suffix of '.js' or '.ds'."
}

RESPONSE:
HTTP/1.1 400 BAD REQUEST
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"2.0",
  "type":"InvalidScriptPathException",
  "message":"Script Path must start with a forward slash '/'."
}

Delete Breakpoints

Removes all the breakpoints from the debugger.

Url

DELETE http://hostname:port/dw/debugger/v2_0/breakpoints

Formats

json, xml

Authentication

Name Description
None No authentication.

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 ClientIdRequiredException   Indicates that the request did not contain a client identifier.
401 NotAuthorizedException   Indicates that the specified user is not authorized.
412 DebuggerDisabledException   Indicates that the Client resource has not been created.

Sample

REQUEST:
DELETE /s/-/dw/debugger/v1_0/breakpoints HTTP/1.1
Authorization: Basic YWRtaW46RGVtYW5kd2FyZTEh
x-dw-client-id: DebuggerTest
Content-Type: application/json
Content-Length: 0

# in case of success:
 
RESPONSE:
HTTP/1.1 204 No Content

# in case of failure: 

RESPONSE:
HTTP/1.1 401 Unauthorized
Content-Type: application/json;charset=UTF-8
{
  "_v":"2.0",
  "fault":
    {
      "type":"NotAuthorizedException",
      "message":"You are not authorized to use the Script Debugger."
    }
}

RESPONSE:
HTTP/1.1 400 Bad Request
Content-Type: application/json;charset=UTF-8
{
  "_v":"2.0",
  "fault":
  {
    "type":"ClientIdRequiredException",
    "message":"You must have a client identifier in the request header using the key 'x-dw-client-id'."
  }
}

Get Breakpoint

Gets a breakpoint. If the breakpoint cannot be located, this action throws a BreakpointNotFoundException.

Url

GET http://hostname:port/dw/debugger/v2_0/breakpoints/{breakpoint_id}

Formats

json, xml

Authentication

Name Description
None No authentication.

Response Document

Breakpoint

Path Parameters

Parameter Type Description Constraints
breakpoint_id Integer The breakpoint identifier. minLength=1

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 ClientIdRequiredException   Indicates that the request did not contain a client identifier.
401 NotAuthorizedException   Indicates that the specified user is not authorized.
404 BreakpointNotFoundException

id (Integer)

Indicates that the requested breakpoint could not be found.
412 DebuggerDisabledException   Indicates that the Client resource has not been created.

Sample

REQUEST:
GET /s/-/dw/debugger/v1_0/breakpoints/40 HTTP/1.1
Authorization: Basic YWRtaW46RGVtYW5kd2FyZTEh
x-dw-client-id: DebuggerTest
Content-Type: application/json
Content-Length: 0

# in case of success:
 
RESPONSE:
HTTP/1.1 200 OK
{
  "_v":"2.0",
  "id":40,
  "line_number":20,
  "script_path":"/app_storefront_controllers/cartridge/controllers/Cart.js"
}

# in case of error:
 
RESPONSE:
HTTP/1.1 404 Requested resource not found
Content-Type: application/json;charset=UTF-8
{
  "_v":"2.0",
  "type":"BreakpointNotFoundException",
  "message":"Could not find Breakpoint for identifier '40'."
}

in case of error:

RESPONSE:
HTTP/1.1 401 Unauthorized
Content-Type: application/json;charset=UTF-8
{
  "_v":"2.0",
  "fault":
    {
      "type":"NotAuthorizedException",
      "message":"You are not authorized to use the Script Debugger."
    }
}

RESPONSE:
HTTP/1.1 400 Bad Request
Content-Type: application/json;charset=UTF-8
{
  "_v":"2.0",
  "fault":
  {
    "type":"ClientIdRequiredException",
    "message":"You must have a client identifier in the request header using the key 'x-dw-client-id'."
  }
}

Delete Breakpoint

Deletes the breakpoint. If the breakpoint cannot be located, this action throws a BreakpointNotFoundException.

Url

DELETE http://hostname:port/dw/debugger/v2_0/breakpoints/{breakpoint_id}

Formats

json, xml

Authentication

Name Description
None No authentication.

Path Parameters

Parameter Type Description Constraints
breakpoint_id Integer The breakpoint identifier. mandatory=true, minLength=1

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 ClientIdRequiredException   Indicates that the request did not contain a client identifier.
401 NotAuthorizedException   Indicates that the specified user is not authorized.
404 BreakpointNotFoundException

id (Integer)

Indicates that the Client resource has not been created.
412 DebuggerDisabledException   Indicates that the Client resource has not been created.

Sample

REQUEST:
DELETE /s/-/dw/debugger/v1_0/breakpoints/40 HTTP/1.1
Authorization: Basic YWRtaW46RGVtYW5kd2FyZTEh
x-dw-client-id: DebuggerTest
Content-Type: application/json
Content-Length: 0

# in case of success:
 
RESPONSE:
HTTP/1.1 204 No Content

# in case of failure:
 
RESPONSE:
HTTP/1.1 404 Requested resource not found
Content-Type: application/json;charset=UTF-8
{
  "_v":"2.0",
  "type":"BreakpointNotFoundException",
  "message":"Could not find Breakpoint for identifier '40'."
}

RESPONSE:
HTTP/1.1 401 Unauthorized
Content-Type: application/json;charset=UTF-8
{
  "_v":"2.0",
  "fault":
    {
      "type":"NotAuthorizedException",
      "message":"You are not authorized to use the Script Debugger."
    }
}

RESPONSE:
HTTP/1.1 400 Bad Request
Content-Type: application/json;charset=UTF-8
{
  "_v":"2.0",
  "fault":
  {
    "type":"ClientIdRequiredException",
    "message":"You must have a client identifier in the request header using the key 'x-dw-client-id'."
  }
}