I am tried to pass params to params argument like this:
query{
tumblrPosts @rest(type: "TumblrPosts", path: "/posts", params: {api_key: $api_key, tag: $tag}) {
response {
posts {
title,
summary,
body,
type,
post_url,
tags
}
}
}
}
But it did not work at all. Params did not pass to the request. The last variant works, but it looks not so nice:
query{
tumblrPosts(api_key: $api_key, tag: $tag) @rest(type: "TumblrPosts", path: "/posts?api_key=:api_key&tag=:tag") {
response {
posts {
title,
summary,
body,
type,
post_url,
tags
}
}
}
}
Based on the example in the docs... pretty sure you need to define it as:
query GetTumblrPosts($api_key: String!, $tag: String!) {
...
Hello @i-hun, your code example indeed is suggested by some of our docs. Unfortunately, we didn’t exactly get around to building that feature.
@fc’s advice is exactly how the system works today. You can merge both your examples:
query GetTumblrPosts($api_key: String!, $tag: String!) {
tumblrPosts(api_key: $api_key, tag: $tag) @rest(type: "TumblrPosts", path: "/posts?api_key=:api_key&tag=:tag") {
response {
posts {
title,
summary,
body,
type,
post_url,
tags
}
}
}
}
To both of you or anyone reading this, I’d love to get this fixed, as currently our API can’t unpack input types.
I haven’t had any time recently to investigate how to implement unpacking. (Via params or other syntaxes that I’d be happy to document on request)
I think this should be fixed or may just be outdated since we now use the new param syntax.