Skip to content

Instantly share code, notes, and snippets.

@joshuaaguilar20
Created January 8, 2019 03:02
Show Gist options
  • Save joshuaaguilar20/a6c33f95f3fe8aa0c54f2d6ade9499de to your computer and use it in GitHub Desktop.
Save joshuaaguilar20/a6c33f95f3fe8aa0c54f2d6ade9499de to your computer and use it in GitHub Desktop.
mondaynotes
JSON = BIG Object
LINK- https://repl.it/@joshuaaguilar20/IndeliblePessimisticProfessionals
Example API call.
Go WebSite and reuqest data.
Request URL Get 200 Todos-
-get (asking for information)
https://jsonplaceholder.typicode.com/todos
fetch('https://jsonplaceholder.typicode.com/todos')
.then(function(response) {
return response.json();
})
.then(function(myJson) {
console.log(JSON.stringify(myJson));
});
-post
Sending Information
{
"data": [{
"type": "articles",
"id": "1",
"attributes": {
"title": "JSON:API paints my bikeshed!",
"body": "The shortest article. Ever."
},
"relationships": {
"author": {
"data": {"id": "42", "type": "people"}
}
}
}],
"included": [
{
"type": "people",
"id": "42",
"attributes": {
"name": "John"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment