How to use the GraphQL API

Hello, I want to use API GraphQL to know the history of the last commits.
For that I would like to use API GraphQL with the code below:

{
  repository(name: "repository", owner: "user") {
    defaultBranchRef {
      target {
        ... on Commit {
          history(first: 5) {
            nodes {
              message
              committedDate
              authoredDate
              oid
              author {
                name
              }
            }
          }
        }
      }
    }
  }
}

How can I implement this code in my site (to have the history of posting on a html page)

Thanks in advance

Excuse me for the translation