Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save boomtrain-support/203b16d9d9c6e1463ace to your computer and use it in GitHub Desktop.
Save boomtrain-support/203b16d9d9c6e1463ace to your computer and use it in GitHub Desktop.
PUT /resources/:model/:id - Update an existing Resource with the specified model type by ID using jQuery
<script>
// Update an existing resource for the model by id
function putResourcesModelId() {
// JSON stringify the resource data
var json_model = JSON.stringify({
'props': {
'title': '{Your New Title}',
'thumbnail': '{URL to the Hosted Image}',
...
}
});
// Send a jQuery AJAX request to update the resource
$.ajax({
url: 'https://api.boomtrain.com/resources/{model}/{id}',
// Replace with your Username, Password, and App Id
headers: {
'x-app-id': '{Your App Id}',
'Content-Type': 'application/json',
'Authorization': 'Basic ' + btoa('{Your Username}:{Your Password}')
},
type: 'PUT',
data: json_model,
success: function(msg) {
console.log(msg);
}
});
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment