Skip to content
Treabereeg edited this page Oct 31, 2013 · 39 revisions

Trouble ticket API
An instance of the DSM API server is already deployed, please contact the TM Forum organization to retrieve public adresses.

Detailed API can be found here API specification

Exposed API

Description
Two resources are managed through the API, troubleTicket and hub. Hub is a subscribe / notification mechanism

troubleTicket

GET troubleTicket/ Get all tickets
GET troubleTicket/{ID} Retrieve a ticket
POST troubleTicket Create a ticket
PUT troubleTicket/{ID} Completely update a ticket (replace its content)
PATCH troubleTicket/{ID} Partially update a ticket

hub
You will need a listening server to use this feature. As an alternative a mock server is provided in the sources, see below in the documentation.

Create a hub containing at least your callback URL, add a query if you want more specific event filtering
POST /hub
GET /hub/{id}
DELETE /hub/{id}

State Machine

Description
A trouble ticket evolves from Status to Status through a workflow. During POST execution troubleTicket is persisted with Submitted status, then the workflow starts asynchronously with 3s pause between each step.

Transitions

Initial State is

            Submitted

From Submitted to

            Rejected  

            Acknowledged  

From Acknowledged to

            InProgress   

            InProgress_Held  

            InProgress_Pending  

            Cancelled  

From InProgress to

            InProgress_Held  

            InProgress_Pending  

            Resolved  

            Cancelled  

From InProgress_Held to

            InProgress  

            InProgress_Pending  

            Resolved  

            Cancelled  

From InProgress_Pending to

            InProgress  

            InProgress_Held  

            Resolved  

            Cancelled  

From Resolved to

            Closed  

            InProgress  

            InProgress_Held  

            InProgress_Pending     

Final state are

            Closed  

            Rejected  

            Cancelled 

Internal or External Workflow ?

For hackathon purpose only, the API offers choice between starting or not a workflow for ticket creation.

No Worklow
This way you can PATCH successively new status according to the State Machine. Use note.text==NoWorkFlow

Workflow

Two ways :

A troubleTicket posted with a note.text==To Held will move through the workflow, ending in a 'Closed' status.

Otherwise, a troubleTicket will halt in InProgress_Pending state, waiting to be wake up by a patch containing note.text==To Resolve or note.text==To Pending or note.text==To Held and correlationId!=null.

See samples
post_Workflow_Auto_ToPending.json
post_Workflow_Auto_ToClosed_Via_Held.json
post_Workflow_No.json
patch_AS_PendingState.json

JSON Samples

Location
src/script/json

Test a deployed API with curl based script

Description
Some shell scripts to play with the API
tt.sh -> Post/Patch/Put/Get on troubleTicket
hub.sh -> Post/Get/Delete on hub
clean.sh -> Remove clients logs

Location
'src/script'

Configure
Edit 'conf.sh' with servername, port, context, basic auth credentials

Help
Run tt.sh, hub.sh without parameters

Test a deployed API with soapUI

Description
Contains sample requests to play with the API

Install
Install SOAP UI from http://www.soapui.org/
Load SOAP UI project located under /soapui

Mock a callback server

Description
a lite J2SE server that logs incoming request to file

Location
'src/script'

Run
mockService.sh {port} {pathToLogFile}

Deploy & run the API from sources

Download Netbeans 7.3 ( only )
Install with glassfish
Import sources from GIT ( menu Team / Clone )
Deploy