
๐Organization
Get organizations
GET /rest/servicedeskapi/organization
This method returns a list of organizations in the Jira Service Management instance. Use this method when you want to present a list of organizations or want to locate an organization by name.
package main
import (
"context"
"github.com/ctreminiom/go-atlassian/jira/sm"
"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")
var (
accountID = ""
start = 0
limit = 50
)
organizations, response, err := atlassian.Organization.Gets(context.Background(), accountID, start, limit)
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 _, organization := range organizations.Values {
log.Println(organization)
}
}Create organization
POST /rest/servicedeskapi/organization
This method creates an organization by passing the name of the organization.
Get organization
GET /rest/servicedeskapi/organization/{organizationId}
Get returns details of an organization. Use this method to get organization details whenever your application component is passed an organization ID but needs to display other organization details.
Delete Organization
DELETE /rest/servicedeskapi/organization/{organizationId}
This method deletes an organization. Note that the organization is deleted regardless of other associations it may have. For example, associations with service desks.
Get organizations
GET /rest/servicedeskapi/servicedesk/{serviceDeskId}/organization
This method returns a list of all organizations associated with a service desk.
Associate organization
POST /rest/servicedeskapi/servicedesk/{serviceDeskId}/organization
This method adds an organization to a service desk. If the organization ID is already associated with the service desk, no change is made and the resource returns a 204 success code.
Detach organization
DELETE /rest/servicedeskapi/servicedesk/{serviceDeskId}/organization
This method removes an organization from a service desk. If the organization ID does not match an organization associated with the service desk, no change is made and the resource returns a 204 success code.
Get Project Organizations
Get users in organization
GET /rest/servicedeskapi/organization/{organizationId}/user
This method returns all the users associated with an organization. Use this method where you want to provide a list of users for an organization or determine if a user is associated with an organization.
Add users to organization
POST /rest/servicedeskapi/organization/{organizationId}/user
This method adds users to an organization.
Remove users from organization
DELETE /rest/servicedeskapi/organization/{organizationId}/user
This method removes users from an organization.
Last updated
Was this helpful?