# How to read response from mutation in javascript client?

**URL:** https://discuss.dgraph.io/t/how-to-read-response-from-mutation-in-javascript-client/2143
**Category:** Users
**Created:** [January 19, 2018, 12:49pm UTC](https://discuss.dgraph.io/t/how-to-read-response-from-mutation-in-javascript-client/2143 "2018-01-19T12:49:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![selmeci](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@selmeci](https://discuss.dgraph.io/u/selmeci)
#### Post date: [January 19, 2018, 12:49pm UTC](https://discuss.dgraph.io/t/how-to-read-response-from-mutation-in-javascript-client/2143/1 "2018-01-19T12:49:13Z")

</div>

Hi,

I’m try to use official javascript client for [dGraph](https://github.com/dgraph-io/dgraph-js).

How can I read response data from mutation? I would like to read assigned uids for new nodes.

Thank you.

---

<div class="post-metadata">

### Author: ![sboorlagadda](https://avatars.discourse-cdn.com/v4/letter/s/a8b319/32.png) [@sboorlagadda](https://discuss.dgraph.io/u/sboorlagadda)
#### Post date: [January 19, 2018, 4:57pm UTC](https://discuss.dgraph.io/t/how-to-read-response-from-mutation-in-javascript-client/2143/2 "2018-01-19T16:57:36Z")

</div>

Assuming you are using gRPC.

```
const serialized = new Uint8Array(new Buffer(json));
const mu = new dgraph.Mutation();
mu.setSetJson(serialized);
return txn.mutate(mu).then((res) => {
    txn.commit();
    console.log(res.getUidsMap().get("blank-0")) . => Like so you can retrieve the UIDs returned from a mutation.
    return;
}).catch((e) => {
    console.log(e);
    return txn.discard();
});
```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/2/2b38fdece2abe5814f2e51bee69d1e67fc304b0a.png) [@system](https://discuss.dgraph.io/u/system)
#### Post date: [February 18, 2018, 4:57pm UTC](https://discuss.dgraph.io/t/how-to-read-response-from-mutation-in-javascript-client/2143/3 "2018-02-18T16:57:40Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
