Skip to main content
POST
/
servers
/
{server_id}
/
actions
Go (SDK)
package main

import(
	"context"
	"os"
	latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
	"github.com/latitudesh/latitudesh-go-sdk/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := latitudeshgosdk.New(
        latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
    )

    res, err := s.Servers.RunAction(ctx, "sv_LA73qkJwdaJ2o", operations.CreateServerActionServersRequestBody{
        Data: operations.CreateServerActionServersData{
            Type: operations.CreateServerActionServersTypeActions,
            Attributes: &operations.CreateServerActionServersAttributes{
                Action: operations.CreateServerActionActionReboot,
            },
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.ServerAction != nil {
        // handle response
    }
}
{
  "data": {
    "id": "act_V0DgYxxN9Ed4A",
    "type": "actions",
    "attributes": {
      "status": "Rebooting device"
    }
  },
  "meta": {}
}

Authorizations

Authorization
string
header
required

Path Parameters

server_id
string
required

Body

data
object
required

Response

201 - application/vnd.api+json

Created

data
object
meta
object