1. Update a Task

Update a Task

spaces/:space_id/tasks/:task_id

Path Parameters

  • :space_id

    required number

    Numeric id of a space

  • :task_id

    required number

    The task id

Request Body Properties

  • task

    The Task Object
    • id

      number

      Numeric ID of your task

    • name

      string

      Given name of your task

    • description

      string

      A brief description of your task for your editors

    • task_type

      string

      Default: webhook; Currently available: webhook

    • webhook_url

      string

      URL of webhook that should be called when tasks is being executed

    • lambda_code

      string

      Beta: Lambda function code

Response Properties

  • task

    The Task Object
    • id

      number

      Numeric ID of your task

    • name

      string

      Given name of your task

    • description

      string

      A brief description of your task for your editors

    • task_type

      string

      Default: webhook; Currently available: webhook

    • last_execution

      string

      Date and time of last execution (Format: YYYY-mm-dd HH:MM)

    • webhook_url

      string

      URL of webhook that should be called when tasks is being executed

    • last_response

      string

      Last execution response log

    • lambda_code

      string

      Beta: Lambda function code

Request
curl "https://mapi.storyblok.com/v1/spaces/606/tasks/124" \ 
  -X PUT \
  -H "Authorization: YOUR_OAUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d "{\"task\": {\"name\": \"My Updated Task Name\",\"task_type\": \"webhook\",\"webhook_url\": \"https://www.storyblok.com\"}}"
Request
// Using the Universal JavaScript Client:
// https://github.com/storyblok/storyblok-js-client
Storyblok.put('/spaces/606/tasks/124', {
  "task": {
    "name": "My Updated Task Name",
    "task_type": "webhook",
    "webhook_url": "https://www.storyblok.com"
  }
})
  .then(response => {
    console.log(response)
  }).catch(error => { 
    console.log(error)
  })
Request
$client = new \Storyblok\Client('YOUR_STORYBLOK_SPACE_ACCESS_TOKEN');

$payload = [
  "task" =>  [
    "name" =>  "My Updated Task Name",
    "task_type" =>  "webhook",
    "webhook_url" =>  "https => //www.storyblok.com"
  ]
];

$client->put('/spaces/606/tasks/124', $payload)->getBody();
Request
require 'storyblok'
client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')

payload = {
  "task" =>  {
    "name" =>  "My Updated Task Name",
    "task_type" =>  "webhook",
    "webhook_url" =>  "https => //www.storyblok.com"
  }
}

client.put('/spaces/606/tasks/124', payload)
Request
HttpResponse<String> response = Unirest.put("https://mapi.storyblok.com/v1/spaces/606/tasks/124")
  .header("Content-Type", "application/json")
  .header("Authorization", "YOUR_OAUTH_TOKEN")
  .body("{\"task\": {\"name\": \"My Updated Task Name\",\"task_type\": \"webhook\",\"webhook_url\": \"https://www.storyblok.com\"}}")
  .asString();
Request
var client = new RestClient("https://mapi.storyblok.com/v1/spaces/606/tasks/124");
var request = new RestRequest(Method.PUT);

request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
request.AddParameter("application/json", "{\"task\": {\"name\": \"My Updated Task Name\",\"task_type\": \"webhook\",\"webhook_url\": \"https://www.storyblok.com\"}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Request
import Foundation

let headers = [
  "Content-Type": "application/json",
  "Authorization": "YOUR_OAUTH_TOKEN"
]

let postData = NSData(data: "{\"task\": {\"name\": \"My Updated Task Name\",\"task_type\": \"webhook\",\"webhook_url\": \"https://www.storyblok.com\"}}".data(using: String.Encoding.utf8)!)

let request = NSMutableURLRequest(url: NSURL(string: "https://mapi.storyblok.com/v1/spaces/606/tasks/124")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)
request.method = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
Request
import requests

url = "https://mapi.storyblok.com/v1/spaces/606/tasks/124"

querystring = {}

payload = "{\"task\": {\"name\": \"My Updated Task Name\",\"task_type\": \"webhook\",\"webhook_url\": \"https://www.storyblok.com\"}}"
headers = {
  'Content-Type': "application/json",
  'Authorization': "YOUR_OAUTH_TOKEN"
}

response = requests.request("PUT", url, data=payload, headers=headers, params=querystring)

print(response.text)