This file contains 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
{ | |
"document": { | |
"date": "01/30/2013", | |
"author": { | |
"name": { | |
"prefix": "Dr", | |
"given": [ | |
"Samir" | |
], | |
"family": "Khan" |
This file contains 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
//Provide variables for `myData`, `myFileName`, and `myMimeType` | |
// and #import "AFNetworking.h" | |
AFHTTPRequestOperationManager *fileHttpClient = [[AFHTTPRequestOperationManager alloc] initWithBaseURL:[NSURL URLWithString:@"https://apiv2.catalyze.io"]]; | |
fileHttpClient.responseSerializer = [AFHTTPResponseSerializer serializer]; | |
[fileHttpClient POST:@"/v2/users/files" parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) { | |
[formData appendPartWithFileData:myData name:@"file" fileName:myFileName mimeType:myMimeType]; | |
} success:^(AFHTTPRequestOperation *operation, id responseObject) { | |
NSDictionary *fileObject = [NSJSONSerialization JSONObjectWithData:responseObject options:0 error:nil]; |
This file contains 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
{ "name" : "Medication", "schema": { "startDate":"string", "endDate":"string", "category": "string", "author": "string", "performer": "string", "brandDrug": "object", "activeDrug": "object", "doseQty":"object", rateQty: "object", "frequency": "object", "pricingInfo": "object", "bscData":"object" } } |
This file contains 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
//First post the schema to Catalyze. | |
//You mentioned that it needed to have an ID (auto-generated, unless you want a custom one), timestamp (let's use a UNIX timestamp), and a JSON object | |
//You'll need to auth and grab a session token first. See the API docs here: https://docs.catalyze.io/api/latest/ | |
var Request = new XMLHttpRequest(); | |
Request.open('POST', 'https://api.catalyze.io/v2/classes'); | |
Request.setRequestHeader('X-Api-Key', '<your API key>'); | |
Request.setRequestHeader('Authorization', 'Bearer <Your Session Token>'); |
This file contains 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
foreach (var model in models) | |
{ | |
if (model.first_name == null) | |
{ | |
return Request.CreateResponse(HttpStatusCode.BadRequest, | |
new ErrorResponse[] | |
{new ErrorResponse(ErrorCodes.FirstNameRequired)}); | |
//OR record this element in the array and then create an array without these elements and fail silently |
This file contains 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
[ | |
{ | |
"dirty": true, | |
"modified_on": "2013-09-16T22:36:12.546Z", | |
"obj_data": { | |
"id": "523787dc37c4db2ef46e5637", | |
"activities": 0, | |
"added_by": { | |
"id": "523763ce37c4db286465d807", | |
"added_by": "523763ce37c4db286465d807", |
This file contains 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
string filePath = Path.Combine(TempPath, file.FileName); | |
/*Even though Jquery handles checking by doctypes, we have built checking on the server side | |
* To protect against javascript hacks | |
* | |
* The jquery doesn't normalize the text in the file extension. We may choose to | |
* handle this ourselves when we come up with a standard naming scheme for consistency's sake later, | |
* but for now, ToLower() the extension. */ | |
string checkValidExt = Path.GetExtension(filePath); | |
if (checkValidExt.ToLower() != ".png" || checkValidExt.ToLower() != ".jpg") | |
{ |
NewerOlder