Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@seit
Created December 10, 2020 10:39
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/050f2b0624e4849cddad85a74e78085e to your computer and use it in GitHub Desktop.
Save seit/050f2b0624e4849cddad85a74e78085e to your computer and use it in GitHub Desktop.
GraphqlController_1
public String graphqlExec(){
QueryJson query = new QueryJson(
query("<商品ID>",
"<コレクションID>"));
String resJsonStr = apiClient.post(query,String.class);
logger.debug(resJsonStr);
return "index";
}
private String query(String productId, String CollectionId){
// 商品がコレクションに含まれているか確認
return "query {"
+ " product(id:\"" + productId + "\") {"
+ " storefrontId"
+ " inCollection(id:\""+ CollectionId + "\") "
+ " variants(first:250){"
+ " edges{"
+ " node{"
+ " storefrontId"
+ " }"
+ " }"
+ " }"
+ " }"
+ "}";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment