# Super simple schema with remote type...doesn't work

**URL:** <https://discuss.dgraph.io/t/super-simple-schema-with-remote-type-doesnt-work/15716>\
**Category:** GraphQL\
**Tags:** kind:question\
**Created:** [October 4, 2021, 2:36am UTC](https://discuss.dgraph.io/t/super-simple-schema-with-remote-type-doesnt-work/15716 "2021-10-04T02:36:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![khoi-fish](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/khoi-fish/32/8883_2.png) [@khoi-fish](https://discuss.dgraph.io/u/khoi-fish)\
**Post date:** [October 4, 2021, 2:36am UTC](https://discuss.dgraph.io/t/super-simple-schema-with-remote-type-doesnt-work/15716/1 "2021-10-04T02:36:15Z")

</div>

I have a super simple schema with a remote type that reaches out to the [https://jsonplaceholder.typicode.com/posts](https://jsonplaceholder.typicode.com/posts) REST api.

```auto
type Post @remote {
  id: Int! @id
  title: String!
  message: String! @remoteResponse(name: "body")
}

type User {
    username: String! @id
    posts: [Post!]! @custom(http: {
      url: "https://jsonplaceholder.typicode.com/posts",
      method: GET
    })
}

```

However, it always fails with `unable to find a required field with type ID! or @id directive for @custom field posts.`. Does anyone have any clues as to why?

---

<div class="post-metadata">

**Author:** ![amaster507](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/amaster507/32/4123_2.png) [@amaster507](https://discuss.dgraph.io/u/amaster507)\
**Post date:** [October 4, 2021, 3:56am UTC](https://discuss.dgraph.io/t/super-simple-schema-with-remote-type-doesnt-work/15716/2 "2021-10-04T03:56:51Z")

</div>

I am pretty sure you can’t use the `@id` directive with a remote type. A remote type means it never gets written to the Dgraph datastore and it is only for reference. The `@id` directive is for the Dgraph datastore to tell the data mutation scripts to use upserts for those xid fields. It will probably work if you just remove that directive from the remote type.

---

<div class="post-metadata">

**Author:** ![khoi-fish](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/khoi-fish/32/8883_2.png) [@khoi-fish](https://discuss.dgraph.io/u/khoi-fish)\
**Post date:** [October 4, 2021, 6:08am UTC](https://discuss.dgraph.io/t/super-simple-schema-with-remote-type-doesnt-work/15716/3 "2021-10-04T06:08:59Z")

</div>

So like:

```auto
type Post @remote {
  title: String!
  message: String! @remoteResponse(name: "body")
}

type User {
    username: String! @id
  	posts: [Post!]! @custom(http: {
      url: "https://jsonplaceholder.typicode.com/posts",
      method: GET
    })
}

```

Unfortunately, still the same error

---

<div class="post-metadata">

**Author:** ![sakib](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/sakib/32/5757_2.png) [@sakib](https://discuss.dgraph.io/u/sakib)\
**Post date:** [October 4, 2021, 8:51am UTC](https://discuss.dgraph.io/t/super-simple-schema-with-remote-type-doesnt-work/15716/4 "2021-10-04T08:51:52Z")

</div>

Custom requests need to have either an `ID` or `@id` field (you can check the docs [here](https://dgraph.io/docs/graphql/custom/directive/#how-custom-fields-are-resolved)). So you need to do something like this:

```auto
type Post @remote {
    ...
}

type User {
    ...
  	userId: String! @id
  	posts: [Post!]! @custom(http: {
      url: "https://jsonplaceholder.typicode.com/posts?userId=$userId",
      method: GET
    })
}

```
