Skip to content

Instantly share code, notes, and snippets.

@seit
Created December 10, 2020 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seit/7cef28813cab5d881fdb37f448a7bfb2 to your computer and use it in GitHub Desktop.
Save seit/7cef28813cab5d881fdb37f448a7bfb2 to your computer and use it in GitHub Desktop.
ApiClient
public <T> T post(Object request, Class<T> responseType, Object... uriVariables) {
HttpHeaders headers = new HttpHeaders();
headers.set("X-Shopify-Access-Token", "<キー情報>");
headers.set("Content-Type", "application/json");
try{
T response = restTemplate.postForObject("https://<shopifyホスト名>/admin/api/2020-10/graphql.json",
new HttpEntity<>(request, headers),
responseType,
uriVariables);
return response;
} catch (HttpClientErrorException e) {
throw e;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment