Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
asanaのセクション配下にタスクをPHPで追加するサンプル
<?php
$data = array('data' => array(
'memberships' => array(array('project' => $_POST['project'], 'section' => $_POST['section'])),
'name' => $_POST['word'],
'workspace' => $_POST['workspace'],
'notes' => $_POST['note']
));
$header = array(
'Content-Type: application/json',
'Authorization: Bearer ' . $bearer
);
$options = array(
'http' => array(
'ignore_errors' => true,
'method' => 'POST',
'header' => implode("\r\n", $header),
'content' => json_encode($data)
)
);
$url = 'https://app.asana.com/api/1.0/tasks';
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$result = json_decode($result);
echo $result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment