Shopify API calls from a java external application - shopify

My clients have decided to open a store on Shopify, and they want a list of the items for sale there to be displayed in our website; which is built in jsp (liferay). I'm completely new to Shopify, so I've been checking around, but I'm getting confused.
There appears to be a "Shopify4J" library which should make calls to the API real simple, which is basically what I need (retrieve a list of all items from the store). However, I see all these examples with urls, and I've read that Shopify API can only be used from Shopify apps.
My question is, can I actually call the API from my website to retrieve the item list? Or do I have to create a Shopify app that would connect to my site via something like webservice?

You could use the api and pull in the products, but I think a better solution would be to install the widget app and just embed the widget into your site. Much simple and does exactly what you want as far as I can tell.
Shopify Widget App: http://apps.shopify.com/shopify-widgets

In order to make an Shopify API call, You'll have to first create a token. This can be done by going to Apps > Manage private apps and then click Generate API Credentials. You'll be provided with API Key and password to use in your call.
Here is the documentation of private apps.
And here is Shopify's api documentation.

Related

Shopify - Embedded App - User session and webhooks

I'm fairly new to Shopify development and I'm trying to understand the best way to address our requirement. Apologies if some of these are basic questions.
The intent is to build an embedded public application that is intended to:
Have a floating component that's present on all pages on the online
store.
React to the user journey e.g. do stuff when the user adds
items to cart, completes a checkout, etc.
Send events to our server through the journey to allow our server to provide relevant
info, regardless of the store theme.
Have the ability to do this at an individual session level i.e. not all users will have the same experience.
I had a few questions around this:
Will it be possible to add the script to the main theme page and
have it load on all pages?
Is there a better alternative, particularly if the integration is supposed to be light-touch for admins?
What is the best way to get access to the individual user session from the app (assuming we can request the appropriate permissions as a part of the app installation)?
Is app bridge and session token required for this?
Is it possible to build this app using Angular? I understand Shopify framework is API-based and in theory any UI framework should work, but will a deeper linking with the user session be possible with Angular?
If we get enable web hooks for the various events, would it be a reliable way to detect events happening in the user journey? If so, what will be the correlation id between the events from the app and the web hooks?
Is it possible to detect the page the user is in, regardless of the theme? For example: Is there a way to identify that the user has added an item to the cart regardless of the theme used or is a webhook our best bet for those events?
Thanks in advance!
There is one thing you can do that would support most of your needs. Create an App, and set that App up with a Proxy. Shopify will then support the customer centric store theme to use a secure Ajax callback to your App using the proxy. So you can always call a proxy like /tool/customer_check with or without a customer ID from anywhere in the store.
You can imagine how powerful that is. You can return Liquid or more commonly, JSON. Boom! You're in business.
Of course, there are alternatives, all with the caveat your mileage may vary. None of this is predicated on any particular tech stack, meaning you can use what you like and know.

Can you redirect user from Shopify order confirmation page to third party website and pass order details

I have done some research, where I am trying to achieve quite simple thing.
On Shopify order confirmation page display link to allow user to click and visit third party website, ideally link would contain order details as encoded parameters.
Is there simple way how to achieve it? Shopify checkout seems to be quite limited when it comes to customization.
There is an addition_scripts in the shopify checkout admin section where you can write custom javascript function. (usually designed for analytics scripts) You can write some custom javascript redirects.
From there you will need to figure out how to pass the order information to the third party site. You can use cookies to save the customer id and request his last order using a Rest API request or some other approach that meets your required output/functionality in the third party site. (how will you secure this I'm not 100% sure)
Please have in mind that you can create a custom App that can hook on the order creation webhook of Shopify and update a database on the third party site.
Once again it really matters what you want to achieve on the 3rd site, but long story short is - Yes, you can redirect from that page using javascript.

How to create custom module (CRUD) in shopify? Like, Product and Navigation

I am new in Shopify and My requirement to add more than one custom module in Shopify.
Like, admin panel (back end) side manage all module (CRUD).
I also developed a custom theme in Shopify with slate and liquid.
But, I have no idea about the custom module.
Anyone can share any docs and reference sites to related this topic.
Anyone any idea?
Yes you can make this with custom app(module/plugin) shopify documentation
But you should understand how Shopify module works. You can't access direct to database and crate new database tables and rows, or create backend backend code on shopify, but you can manipulate data (products, orders, discounts, etc..) through shopify api and send data into liquid template or pages. Good example, and tutorial for PHP developers is there (Shopify app development in PHP)
If you want crate new data source (For example Blog, Comments or something like that) then you should crate that part on another server (Backend part) and connect with your app (module/plugin), and after that you can use data from another server in your Shopify templates or pages. Good example, and tutorial for PHP developers is there (Shopify app development in PHP)

Shopify Delivery App API

I'm a developer and I'm working on my own Shopify app
at the moment. I wanted to ask is there ability to get Product
download URL using API or may be somehow accessing Shopify Delivery app API? I
tried, but it seems that I can not get any info about downloadable
products using API, usual set of data only, like for any other
products. Is it really so, and there is no way to get product download
link using API (product API or may be order API).

Tracking query strings in Shopify, using webhooks and admin options

I was redirected here by Shopify support. I have three main questions for a project I'll be working on and wanted to see how possible some of the things would be.
We are looking to develop a plugin for use with Shopify to track purchases through the use of a link shortener (to see which link referred what purchases, etc.). I have a few questions that I'm not 100% sure on even after reading through the documentation.
The first problem that I seem to have is tracking the query string that the link shortener appends to the URL once it redirects. For this service, they use "?visit_id={hash}" and I need to be able to access this--at the very least on the "Thank You" page after an order. I saw in the docs that there is "landing_page_ref" (http://wiki.shopify.com/Order#landing_site_ref) but considering our query string is "visit_id" instead of one of the acceptable parameters, how would I be able to use that query string?
Lastly, I just have a question about how webhooks work with plugins that are on the app store. I know I can just call webhooks to wherever I want, like my personal server, but if this app gets onto the app store, I obviously don't want to hook everything to my own server. Is there a way to make it run on the store itself, and which URL should I use?
Lastly, what is the preferred method for handling configuration options for the plugin? Is there a way to hook into the admin backend or would all configuration have to be in a file within the plugin?
Thanks,
Andrew
I'll do my best to answer these for you. It sounds like you're used to building plugins for something like Wordpress - Shopify apps are a bit different.
You can't access anything on the thank you page for the order.
The thank you page/checkout process goes through a secured Shopify page that you don't have access to - so if you want information about what your URL shortener attached to the store pages, you'll need to retrieve it while they're on the page (using something like a ScriptTag + Javascript to track the query string), or hope that it's inside the Order when you retrieve it later (using the API or a webhook).
Webhooks need to talk to a server you run.
They send the information to you, and then you process it and deal with it. If you want to use webhooks, you will need to run a server with your app on it for the webhooks to talk to.
You manage your own config.
Because you're running your own server to handle those webhooks, you handle configuration for your plugin there. The apps I've worked on typically have their own database for managing configuration options, as well as an admin panel to manage them (it's what the user accesses when they click 'Log Into [Your App]' on the "Manage Apps" screen).
You'll need to run your own server to host your Shopify app.