Okay so I'm VERRY VERRY VERRY new to the subject so please go easy on me. What I have done is to create a wordpress woocommerce website. What I want to do now is to get product-data from the wordpress site in node.js. If I have understood everything correctly i first have to Authenticate myself.
First i installed the WooCommerce package with:
npm install --save woocommerce-api
Then i tried to Authenticante like this:
var WooCommerce = require('woocommerce');
var wooCommerce = new WooCommerce({
consumerKey: 'ck_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
consumerSecret: 'cs_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
url: 'http://localhost/wordpress',
});
I realise It's an verry open question and i might be far of from on the right track. But I would appriciate some tips or guiding.
Thanks!
Well, you npm installed 'woocommerce-api', so you need to require that, not 'woocommerce'.
var WooCommerceAPI = require('woocommerce-api');
Refer to the documentation, but it looks like you instantiated mostly correctly. If you're using the WP REST API you'll need to include the keys wpAPI and version, as per the library's documentation: https://www.npmjs.com/package/woocommerce-api
Now, if you want to get products, you would do something like this:
wooCommerce.getAsync('products').then(function(result) {
return JSON.parse(result.toJSON().body);
});
Or you can use .get instead of .getAsync if you'd prefer to use callbacks over promises.
Related
Hello lads/las I am working on a project which trigger "SendBird" messaging service; I implemented all the basic functions but right now I am trying to use Emoji for ease of use inside it. Have no idea where to start, any suggestion Appreciate.
Need to mention I need free license service if you are suggesting any API's. :D
You can use ReactEmoji.
Here's a link to the github repository : https://github.com/banyan/react-emoji.
Just do npm install react-emoji --save to save it as a dependency to your project. Then import it to your project import ReactEmoji from 'react-emoji'.
Then just to {ReactEmoji.emojify(*your message here*)} . The emojify function will render your message and turn it into an object, which is going to display as an icon later.
Unicode emojis should be supported on SendBird by default; unless your browser does not support them natively, they should be rendered without any problems.
I'm not sure how to preface this. I'm working on an angular wrapper for the Google Client API (note: I'm doing this simply because I haven't found anything that works for me, so if you know of a Google API / Angular, let me know)
I'm trying to make this as generic as possible, so what I would like is something like a function that goes
function makeApiCall (library, collection, method, cb){
gapi.client[library][collection][method](
}
Now if we notice, I'm not checking that the library has been loaded, and I'd like to load the library if it hasn't been already. Problem is that not all libraries from Google have the same version, and as of right now I do not know of a way to check the latest version.
I've tried somethings like the following
gapi.client.load('calendar', 'latest', cb);
gapi.client.load('calendar', 'release', cb);
I remember a long time ago you could use ... well one of those (can't remember which). Is there some way to do this now? Otherwise I'll have to figure something else out.
Can anyone tell me what GitHub APIs I should use for retrieving GitHub showcases? Thanks.
In order to get the list of GitHub showcases, what exact GitHub API should I use?
After I select a topic, to retrieve the repos under the topic (e.g. Made in Africa), what exact API should I use?
There's no API to list or GET a showcase.
I've taken a look and the closest you could get (which is still quite a bit far from your request) is to use the GitHub Search API. However, a list like the one you suggested, Made in Africa is completely curated and the parameters to get such results are not part of the search syntax, e.g. country of origin.
I'll keep an eye on this, and make sure to come back and correct the answer if anything changes.
While Github does not yet offer a showcase API, there is a node package available at https://www.npmjs.com/package/gh-explore that you can use to GET a showcase.
Get the module using npm
npm install --save gh-explore
Query for the showcase
const ghExplore = require('gh-explore');
ghExplore.showcases.get({ showcase: 'made-in-africa' }, function (err, showcase) {
console.log(showcase);
});
Although the question is marked with javascript and node tags specifically I thought it pertinent to mention that I am developing a similar library to achieve this in python 3. You can refer to the repo here https://github.com/victorbordo/gh-showcases
I realize I can use the since parameter in my API call to determine which range of repos to download:
'https://api.github.com/repositories?since=0'
But is there a way to only pull the most recently updated repositories?
I checked out https://www.githubarchive.org/ but I could not find an easy to use command line interface associated with it. It seems like the only way to use it is to use Google's SDK. I am trying to get a list of all the most recently updated repos on Github using Node.js.
API init
self = None
assign = Null
'https://api.github.com/repositories?since=0'
'https://api.github.com/repositories?since=0'
I've been trying to write a typescript application in visual studio using node.js to store and access data in an azure table store.
I've been having some trouble with the tutorials I've found. I've yet to get one to work properly.
I have Node installed on my machine and a tablestore set up in azure.
I'm not exactly sure what needs to be done in visual studio to get all the necessary packages/modules/whatever installed correctly.
Many of the tutorials I've read have used express.js and or have "npm install"ed things and while I have no issue running the commands I don't really understand what I'm installing.
tl;dr I want to make an html page where I can submit and display items to/from azure table store using node.js, typescript, and visual studio
Also: I'd be willing to drop the typescript in favor of javascript if need be.
That tutorial looks like it might be based on the old Node storage package. We have recently posted a new storage library for node - which can be found here: https://www.npmjs.org/package/azure-storage. Also take a look at the following Getting Started to help get you up and running: Store structured data with Table storage.
I will follow up tomorrow to see what we can do to either remove the old tutorial or get it updated. Let me know if anyone wants to volunteer to update the old tutorial!
Jason
I followed this one (I'm assuming you probably tried this as well)
http://azure.microsoft.com/en-us/documentation/articles/storage-nodejs-use-table-storage-web-site/
To boil it down to just what you need in javascript ...
1.Create the table in Azure portal with appropriate data/partition key.
2.NPM necessary packages: azure, async
3.Add the following to app.js (change table_Users to whatever you want to name your table):
var azure = require('azure');
var storageClient = azure.createTableService("<accountname>", "<accountkey>");
storageClient.createTableIfNotExists("table_Users", function tableCreated(error) {
if(error) {
throw error;
}
});
var query = azure.TableQuery
.select()
.from("<tablename>");
//.where('completed eq ?', false); put criteria here.
storageClient.queryEntities(query, function entitiesQueried(error, result) {
// do what you want with result
});