Mobile app with Flutter fetch data shopify store (beginner)

SPJVR
Tourist
8 0 1

Hi,

I have been creating mobile applications using Flutter, what I want to do right now is fetch the data from my Shopify store.
I have never worked with API's before but I know the purpose of using them. I am looking at different guides online but the information is very overwhelming.

I have managed to fetch my data using this function:

getUserData() async {
var response = await http.get(Uri.https(
'{apikey}:{password}@{hostname}.myshopify.com',
'/admin/api/{version}/{resource}.json'));
var jsonData = jsonDecode(response.body);
print(jsonData);
}

{resource} in this case is Customer, adding getUserData() to a button I now print out my customers, this took me like 8h to set up.

I wont be asking any specific questions, but since this thing with API's is new to me and I wouldnt call myself a Flutter expert aswell. Are there any good guides out there? I would like to fetch my data with storefront API, I've got the token but I have no clue how to use it in my code so I can access the data. I am reading the storefront documentation on shopify but being new to all this it just feels it's over my head to grasp. 

Edit: I will be setting up querys using GraphQL (graphql_flutter 5.0.0 is imported)

L_J_K
Shopify Staff
Shopify Staff
305 41 49

Hey @SPJVR 

Thanks for getting in touch. I can confirm there's actually no (official) docs that we've released regarding Flutter. Sound like you've been checking it out already but the Storefront API reference docs would be the best place to start.

There's an official Storefront API Learning kit here too which would run you through querying the endpoint (including querying customers too). Hope that helps!

| API Support @ Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
0 Likes
novidan
New Member
1 0 0

@SPJVR @L_J_K 

1. Hi, what to pass in the {resource}, when I am trying to fetch data from my store, is it 

graphql.json?
2. Do I have to pass the shop name in  {hostname}?
0 Likes