MerryFairyTalesAD440 / API

1 stars 2 forks source link

Upload image to Azure storage #15

Open niss3n opened 5 years ago

FrancescoWard commented 5 years ago

Task : Insert an image or file and corresponding JSON into Blob Storage and CosmosDB

time estimate : 5 hrs

reference(s) :

FrancescoWard commented 5 years ago

progress : tested azure http-trigger to insert a JSON document into cosmosDB under personal account , time estimate : 8 hrs , reference : https://github.com/MerryFairyTalesAD440/API/tree/francesco-db-write

FrancescoWard commented 5 years ago

Using existing mongodb api created new visual studio http trigger with mongodb driver to write a new document. -> https://github.com/MerryFairyTalesAD440/API/tree/francesco-mongodb

to test, please send a POST request to the following URL : https://ad4401boxfransprint263s2plkbwxejg.azurewebsites.net/v1/writeDoc

and send the following in the body : `{ "id":"0", "title" : "Cinderella", "description" : "children's book", "author":"random author" }

MacOS:

curl -X POST -d '{ 
 "id":"0", 
 "title" : "Cinderella", 
 "description" : "children'\''s book", 
 "author":"random author" 
}' -v -i 'https://ad4401boxfransprint263s2plkbwxejg.azurewebsites.net/v1/writeDoc'

Windows:

curl -X POST -d "{ 
 'id':'0', 
 'title' : 'Cinderella', 
 'description' : 'childrens book', 
'author':'random author' 
}" -v -i "https://ad4401boxfransprint263s2plkbwxejg.azurewebsites.net/v1/writeDoc"

then check the "ad440cosmosdb" data explorer window in the ToddySM cosmosDB account and verify that in "outDatabase/Books/documents" a new document is present.

Link to wiki : https://github.com/MerryFairyTalesAD440/API/wiki/CosmosDB

Time spent (total) : 12 hrs