# Run a mutation with a external id

**URL:** https://discuss.dgraph.io/t/run-a-mutation-with-a-external-id/3072
**Category:** Dgraph
**Created:** [August 24, 2018, 3:57am UTC](https://discuss.dgraph.io/t/run-a-mutation-with-a-external-id/3072 "2018-08-24T03:57:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![dxGuan](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/dxguan/32/1240_2.png) [@dxGuan](https://discuss.dgraph.io/u/dxGuan)
#### Post date: [August 24, 2018, 3:57am UTC](https://discuss.dgraph.io/t/run-a-mutation-with-a-external-id/3072/1 "2018-08-24T03:57:50Z")

</div>

I am trying to use a external id instead of default **UID** for a subject of a N-quad record.

According to the docs: [External-ids](https://docs.dgraph.io/v1.0.7/mutations/#external-ids):

I should use `a_fixed_identifier` as the subject of a N-quad record, so I try to mutate the database like this:

```bash
# <lianlian>: the fixed_identified that I want to use as a external id
# <type>: the predicate
# "product": a value object
curl -s -XPOST localhost:8080/mutate/25 -d '
{
  set {
    <lianlian> <type> "product" .
  }
}
'

```

However, I got a error response:

```auto
{
  "errors": [
    {
      "code": "ErrorInvalidRequest",
      "message": "strconv.ParseUint": parsing \"lianlian\": invalid syntax"
    }
  ],
  "data": null
}

```

Seems like Dgraph tried to parse the **External ID** as a integer which causes the error?

Is it a wrong usage of external id?

---

<div class="post-metadata">

### Author: ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)
#### Post date: [August 24, 2018, 1:50pm UTC](https://discuss.dgraph.io/t/run-a-mutation-with-a-external-id/3072/2 "2018-08-24T13:50:56Z")

</div>

> [@dxGuan](#):
>
> Is it a wrong usage of external id?

Yes.

In the documentation says:

> As of version 0.8 Dgraph doesn’t natively support such external IDs as node identifiers. Instead, external IDs can be stored as properties of a node with an `xid` edge. For example, from the above, the predicate names are valid in Dgraph, but the node identified with `<http://schema.org/Person>` could be identified in Dgraph with a UID, say `0x123` , and an edge

Dgraph will never identify` <lianlian>` as BlankNode or something valid.  
As you can see at [Get started with Dgraph](https://docs.dgraph.io/v1.0.7/design-concepts/#edges)  
In the RDF format used by Dgraph the Entity will always represent a standard Dgraph entity identification. Be it a BlankNode or a UID (eg: 0x1a35).

This part of the [Get started with Dgraph](https://docs.dgraph.io/v1.0.7/mutations/#external-ids) documentation is teaching how to use this xid as part of the Node itself. Not as a RDF markup identifier.

In other words, it is transforming this  
`_: userA <http://schema.org/type> <http://schema.org/Person>.`  
into a node with UID ==\> “0x123” or  
`<0x123> <xid> "http://schema.org/Person".`

It transforms the `<http://schema.org/Person>` into a Dgraph Node  
`<0x123> <xid> "http://schema.org/Person".`

---

<div class="post-metadata">

### Author: ![dxGuan](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/dxguan/32/1240_2.png) [@dxGuan](https://discuss.dgraph.io/u/dxGuan)
#### Post date: [August 27, 2018, 2:41am UTC](https://discuss.dgraph.io/t/run-a-mutation-with-a-external-id/3072/3 "2018-08-27T02:41:28Z")

</div>

I got it.

After reading this [https://docs.dgraph.io/v1.0.7/mutations/#external-ids](https://docs.dgraph.io/v1.0.7/mutations/#external-ids) carefully, I found that: it is the **Dgraph’s input language RDF** supports this form of external id: \<a\_fixed\_identifier\> \<predicate\> literal/node, which I misunderstood it as the form of Dgraph that it supports.

Thanks a lot.
