PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, June 30, 2022

[FIXED] how to make this call from shopify ? (GET/POST) python

 June 30, 2022     api, python, shopify     No comments   

Issue

I have to make this call with Standard shopify API (python)

https://store.myshopify.com/admin/shop.json

what i am getting is :

ipdb> shopify.Shop.current()
shop(2330215)

but :

ipdb> shopify.Shop.get(2330215)
*** ResourceNotFound: Not Found:https://store.myshopify.com/admin/shops/2330215.xml

ipdb>

what is the right way to make such call .


Solution

As far as I can tell, there is no /admin/shops (plural) API path, at all.

You use the API per shop, the shop_url parameter gives you access to a specific shop and then you cannot access other shops nor do you need to use shopify.Shop.get().

The Python library uses a generic base class for all resource types, and that is where the .get() method comes from, but that method has no meaning for shops.

The shopify.Shop.current() returns the one shop resource that you need to care about. It has an .attributes attribute that holds all the data returned by the Shopify API; keys in that mapping also work as attributes on the main resource object:

shop = shopify.Shop.current()
print shop.attributes.keys()
print shop.name 


Answered By - Martijn Pieters
Answer Checked By - Marilyn (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing