Skip to content
This repository was archived by the owner on Oct 8, 2024. It is now read-only.

Commit da7e96a

Browse files
authored
Merge pull request #140 from CodeAndChoke/update-readme
Updated readme
2 parents 39077e4 + 62dde47 commit da7e96a

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ Here are implementations for:
163163

164164
### Resource's CRUD
165165

166+
#### Create Resource
167+
166168
To create a FHIR resource, call
167169
`myClient.create(entry, callback, errback)`, passing
168170
an object that contains the following properties:
@@ -199,9 +201,9 @@ myClient.create(entry,
199201

200202
```
201203

202-
### Search
204+
#### Search Resource
203205

204-
fhir.search({type: resourceType, query: queryObject}),
206+
To search a resource, call `fhir.search({type: resourceType, query: queryObject})`,
205207
where queryObject syntax `fhir.js` adopts
206208
mongodb-like query syntax ([see](http://docs.mongodb.org/manual/tutorial/query-documents/)):
207209

@@ -229,6 +231,32 @@ mongodb-like query syntax ([see](http://docs.mongodb.org/manual/tutorial/query-d
229231

230232
```
231233

234+
#### Update Resource
235+
236+
To update a resource, call `fhir.update({type: resourceType, id: identifier, resource: resourceObject})`.
237+
In case of success,the callback function will be invoked.
238+
239+
Example:
240+
```javascript
241+
this.fhirClient.update({
242+
type: "Patient",
243+
id: 1,
244+
resource: {
245+
name: 'New Name'
246+
}
247+
}).catch(function(e){
248+
console.log('An error happened while updating patient: \n' + JSON.stringify(e));
249+
throw e;
250+
}).then(function(bundle){
251+
console.log('Updating patient successed');
252+
return bundle;
253+
});
254+
```
255+
256+
#### Delete Resource
257+
258+
To update a resource, call `fhir.delete({type: resourceType, id: identifier})`.
259+
232260
For more information see [tests](https://github.com/FHIR/fhir.js/blob/master/test/querySpec.coffee)
233261

234262
## AngularJS adapter: `ng-fhir`

0 commit comments

Comments
 (0)