- Posts: 12
- Thank you received: 0
Please Log in or Create an account to join the conversation.
jBackendHelper::moduleStack($status, 'helloworld');
$app = JFactory::getApplication();
$action = $app->input->getString('action');
$resource = $app->input->getString('resource');
$test = $app->input->getString('test');
$response['status'] = 'ok';
$response['message'] = 'test var is ' . $test;
$response['action'] = $action;
$response['resource'] = $resource;
return true
{
"status": "ok",
"message": "test var is ",
"action": "post",
"resource": "greeting"
}
Please Log in or Create an account to join the conversation.
{
"status": "ok",
"message": "test var is testinurl",
"action": "post",
"resource": "greeting"
}
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
$app->input->server->getString('HTTP_APIKEY')
Please Log in or Create an account to join the conversation.
1) In regards to the api keys. Are they guaranteed to be unique or is it possible they can produce the same key twice?
2) Is it possible to send the api key in the header rather than as a parameter? That seems to be the recommended way to pass an api key from what I am finding online.
3) Taking that a step further, would something like jason web tokens we able to to be used instead?
4) I'm trying to use the helloworld plugin as a text on my site. It works if I make the menu item "free", but when I set it to api key I can't get in. I am using sef urls and would prefer to provide them to my clients that way. For the helloworld test I am entering my the url into postman as mydomain/web-api/get/helloword/greeting. Where do I put the api key while still keeping a sef url and using get. Note, I will most likely be using posts for my custom api, however, the option for get would be nice and the helloworld demo only works with get requests.
5) Regarding posts, I tried modifying the helloworld plugin to test with a post and adding the api key, but it still just returns saying api key required. I am using the url as mydomain/web-api/post/helloworld/greeting. In postman I added the form data as key = api_key and value = mykey. I also tried adding it as json using { "api_key":"mykey" } but still just returned error code "REQ_AKR" API key required. Not even that it was an incorrect key, but as if I didn't even supply one. The one I am adding is valid though.
6) I need to provide a live api and a sandbox api. Should this be done with 2 different api keys or should it be done with different urls?
7) I noticed in postman if I put in an invalid url by accident, which is easy to do, I get back the entire joomla page html. Is there any way to prevent this and always return a json error instead? Note, I only want this to be when using the api, the website still needs to work as expected. Could it somehow be done using a subdomain to access the api?
Please Log in or Create an account to join the conversation.