Skip to content

Latest commit

 

History

History
324 lines (231 loc) · 6.96 KB

ServiceApi.md

File metadata and controls

324 lines (231 loc) · 6.96 KB

Fastly.ServiceApi

const apiInstance = new Fastly.ServiceApi();

Methods

Note

All URIs are relative to https://api.fastly.com

Method HTTP request Description
createService POST /service Create a service
deleteService DELETE /service/{service_id} Delete a service
getService GET /service/{service_id} Get a service
getServiceDetail GET /service/{service_id}/details Get service details
listServiceDomains GET /service/{service_id}/domain List the domains within a service
listServices GET /service List services
searchService GET /service/search Search for a service by name
updateService PUT /service/{service_id} Update a service

createService

createService({ , [comment, ][name, ][customer_id, ][type] })

Create a service.

Example

const options = {
  comment: "comment_example",
  name: "name_example",
  customer_id: "customer_id_example",
  type: "vcl",
};

apiInstance.createService(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
comment String A freeform descriptive note. [optional]
name String The name of the service. [optional]
customer_id String Alphanumeric string identifying the customer. [optional]
type String The type of this service. [optional] [one of: "vcl", "wasm"]

Return type

ServiceResponse

deleteService

deleteService({ service_id })

Delete a service.

Example

const options = {
  service_id: "service_id_example", // required
};

apiInstance.deleteService(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.

Return type

InlineResponse200

getService

getService({ service_id })

Get a specific service by id.

Example

const options = {
  service_id: "service_id_example", // required
};

apiInstance.getService(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.

Return type

ServiceResponse

getServiceDetail

getServiceDetail({ service_id, [version] })

List detailed information on a specified service.

Example

const options = {
  service_id: "service_id_example", // required
  version: 56,
};

apiInstance.getServiceDetail(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version Number Number identifying a version of the service. [optional]

Return type

ServiceDetail

listServiceDomains

listServiceDomains({ service_id })

List the domains within a service.

Example

const options = {
  service_id: "service_id_example", // required
};

apiInstance.listServiceDomains(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.

Return type

[DomainResponse]

listServices

listServices({ , [page, ][per_page, ][sort, ][direction] })

List services.

Example

const options = {
  page: 1,
  per_page: 20,
  sort: created,
  direction: "ascend",
};

apiInstance.listServices(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
page Number Current page. [optional]
per_page Number Number of records per page. [optional] [defaults to 20]
sort String Field on which to sort. [optional] [defaults to 'created']
direction String Direction in which to sort results. [optional] [one of: "ascend", "descend"]

Return type

[ServiceListResponse]

searchService

searchService({ name })

Get a specific service by name.

Example

const options = {
  name: "name_example", // required
};

apiInstance.searchService(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
name String The name of the service.

Return type

ServiceResponse

updateService

updateService({ service_id, [comment, ][name, ][customer_id] })

Update a service.

Example

const options = {
  service_id: "service_id_example", // required
  comment: "comment_example",
  name: "name_example",
  customer_id: "customer_id_example",
};

apiInstance.updateService(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
comment String A freeform descriptive note. [optional]
name String The name of the service. [optional]
customer_id String Alphanumeric string identifying the customer. [optional]

Return type

ServiceResponse

[Back to top] [Back to API list] [Back to README]