
๐Request
Get customer requests
GET /rest/servicedeskapi/request
This method returns all customer requests for the user executing the query.
package main
import (
"context"
"encoding/json"
"github.com/ctreminiom/go-atlassian/jira/sm"
"github.com/ctreminiom/go-atlassian/pkg/infra/models"
"log"
"os"
)
func main() {
var (
host = os.Getenv("HOST")
mail = os.Getenv("MAIL")
token = os.Getenv("TOKEN")
)
atlassian, err := sm.New(nil, host)
if err != nil {
return
}
atlassian.Auth.SetBasicAuth(mail, token)
atlassian.Auth.SetUserAgent("curl/7.54.0")
options := &models.ServiceRequestOptionScheme{
SearchTerm: "",
RequestOwnerships: []string{"OWNED_REQUESTS"},
RequestStatus: "ALL_REQUESTS",
ApprovalStatus: "",
OrganizationID: 0,
ServiceDeskID: 0,
RequestTypeID: 0,
Expand: []string{"serviceDesk", "requestType", "status", "action"},
}
customerRequests, response, err := atlassian.Request.Gets(context.Background(), options, 0, 50)
if err != nil {
if response != nil {
log.Println("Response HTTP Response", response.Bytes.String())
log.Println("HTTP Endpoint Used", response.Endpoint)
}
log.Fatal(err)
}
log.Println("Response HTTP Code", response.Code)
log.Println("HTTP Endpoint Used", response.Endpoint)
for _, customRequest := range customerRequests.Values {
dataAsJson, err := json.MarshalIndent(customRequest, "", "\t")
if err != nil {
log.Fatal(err)
}
log.Println(string(dataAsJson))
}
}Get customer request by id or key
GET /rest/servicedeskapi/request/{issueIdOrKey}
This method returns a customer request.
Subscribe
PUT /rest/servicedeskapi/request/{issueIdOrKey}/notification
This method subscribes the user to receiving notifications from a customer request.
Unsubscribe
DELETE /rest/servicedeskapi/request/{issueIdOrKey}/notification
This method unsubscribes the user from notifications from a customer request.
Get customer transitions
GET /rest/servicedeskapi/request/{issueIdOrKey}/transition
This method returns a list of transitions, the workflow processes that moves a customer request from one status to another, that the user can perform on a request.
Use this method to provide a user with a list if the actions they can take on a customer request.
Perform customer transition
POST /rest/servicedeskapi/request/{issueIdOrKey}/transition
This method performs a customer transition for a given request and transition. An optional comment can be included to provide a reason for the transition.
Create Customer Request
POST /rest/servicedeskapi/request
This method creates a customer request at a service desk.
The payload must include the service desk and customer request type, as well as any fields that are required for the request type.
A list of the fields required by a customer request type can be obtained using the
sm.RequestType.Fieldsmethod.
Last updated
Was this helpful?