If I have a url like <http://mystuff.xyz/stuff/${i...
# orm-help
m
If I have a url like http://mystuff.xyz/stuff/${id}, can I query multiple id's in one request or do I have to do a request per id?
n
I don't understand your question.
Can you provide more context?
m
So if I was to make a request against the url for a particular id. Would I need to make a 2nd request for another id? I keep reading about things like dataloads and batching etc and wondered if this applied here
So could I query multiple id's but in one req to limit network traffic
n
Your question still doesn't make sense to me, I think I'm missing something fundamental about your setup 🙂
why do you have such an URL in the first place?
a
You can load multiple items when doing a graphql query that has a list type in the return. Is that what you were wondering about?
m
@Arnab hmmm yeah maybe it is. Thev api exists because thats a rest api im wrapping
I try pass an array of strings to the query but it just falls on its bum
n
How does your query look like? What do you mean with "it just falls on its bum"? 🙂
m
it brakes 😛
breaks
n
can you be more specific? 🙂
Do you receive an error message?
m
Copy code
Query: {
    stockitem: (parent, args) => {
      const { id } = args
      return fetch(`${baseURL}/stock/${id}`, {
        headers: { 
          'Authorization': 'SECRET',
          'Content-Type': 'application/json'
         }
        }).then(res => res.json())
        .catch(err => console.error(err))
        .then(console.log("Request made."));
    }
  },
No, so if the array contains just one id, i get a response otherwise otherwise if there are 1+ ids, it just returns null
n
ok.
now I understand your initial question:
If I have a url like http://mystuff.xyz/stuff/${id}, can I query multiple id's in one request or do I have to do a request per id?
m
Copy code
{
  stockitem(id: ["23423423423"]) {
    identifiers {
      externalClientReference
    }
  }
}
n
this question can only be answered by the developer responsible for http://mystuff.xyz/stuff/${id}.
m
oh