Created
August 31, 2015 23:44
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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