jasonknight/woocommerce-json-api

Is it possible to test the plugin using cUrl method?

Closed this issue · 4 comments

First of all, thanks for this plugin! It really looks promising since wooCommerce lacks jSon support.

I have installed installed and activated the plugin, I'm planning to test the plugin using cUrl method just to get a grasp of the concept. But I can't seem to make it work.

I tried
curl -X POST -H "Accept: application/json" -H "Content-Type: application/json" -d '{action:"woocommerce_json_api",proc: "get_system_time", arguments: {token: "123",},}' http://localhost/test/

I also tried using the test folder, which also did not work, I get an error that says Invalid API User.

I probably just have the wrong API Page. Can you help?

In order to run the tests in the test directory you need to edit tests/config.php and input your vals.

These tests are using the PHP cURL.

I am sorry that this requires a bit of rigging to get going.

I'm just trying to learn things. :) And thanks for the really fast reply. I'm amaze.

So, here's my config.php file

<?php
$username = 'myuser';
$password = 'mypassword';

If you want to test username/password authentication...

I think there are like 1-2 tests that use those settings. But nothing from suite.php

You also need to setup the user, and make sure the user has perms for the request. You actually have to press the save button on the user profile. Make sure the token is set there as well.