I have installed WP 4.9.5 using nginx and the following plugins: Gravity Forms (v2.3.1) by rocketgenius Advanced Custom Fields PRO (v5.6.10) by Elliot Condon Timber (v1.7.0) by Jared Novack + Upstatement WooCommerce Additional Variation Images (v1.7.12) by WooCommerce WooCommerce (v3.3.5) by Automattic
For some reason i cannot understand REST api calls are not working and return 404 error. Permalinks are enabled! I am trying the simplest GET without requiring authentication
http://domain.test/wp-json/wc/v2/
any help appreciated!
Change link from /wp-json/wc/v2/ to /wp-json/wp/v2/:
For testing purposes you can use: https://demo.wp-api.org/wp-json/wp/v2/
I suggest you to read documentation.
Have a nice day.
Related
In order to test if the urls I made is correct, I put them in my browser to see if I can GET results.
First, I tried GET /v1/products which should return all types of cars and I put it in the browser like this:
https://api.uber.com/v1/products?server_token=MY_TOKEN&latitude=39.914286&longitude=116.461745
Which works fine and gives me a big JSON of products:
{"products":[{"capacity":4,"product_id":"0ed2dbad-c769-41f5-b66d-0767da627f9e","price_details":{"service_fees":[],"cost_per_minute":0.25,"distance_unit":"km","minimum":10.0,"cost_per_distance":1.5,"base":0.001,"cancellation_fee":8.0,"currency_code":"CNY"},"image":"http:\/\/static.uberx.net.cn\/car-types\/mono\/mono-peoplesuber2.png","short_description":"People's Uber +","display_name":"People\u2019s Uber +","description":"People's Uber +"},{"capacity":4,"product_id":"6bf8dc3b-c8b0-4f37-9b61-579e64016f7a","price_details":{"service_fees":[],"cost_per_minute":0.25,"distance_unit":"km","minimum":10.0,"cost_per_distance":1.5,"base":0.001,"cancellation_fee":8.0,"currency_code":"CNY"},"image":"http:\/\/static.uberx.net.cn\/car-types\/mono\/mono-peoplesuber2.png","short_description":"People's Uber","display_name":"People's Uber","description":"People's Uber"},{"capacity":4,"product_id":"93a40036-2670-4a41-bc59-1e901ca33632","price_details":{"service_fees":[],"cost_per_minute":0.4,"distance_unit":"km","minimum":20.0,"cost_per_distance":2.3,"base":15.0,"cancellation_fee":15.0,"currency_code":"CNY"},"image":"http:\/\/static.uberx.net.cn\/car-types\/mono\/mono-china-uberx.png","short_description":"uberX","display_name":"uberX","description":"The low-cost Uber"},{"capacity":4,"product_id":"259df3b5-e062-4b2b-ab81-3e3fbba4b423","price_details":{"service_fees":[],"cost_per_minute":0.7,"distance_unit":"km","minimum":30.0,"cost_per_distance":3.85,"base":18.0,"cancellation_fee":20.0,"currency_code":"CNY"},"image":"http:\/\/d1a3f4spazzrp4.cloudfront.net\/car-types\/mono\/mono-black.png","short_description":"UberBLACK","display_name":"UberBLACK","description":"The original Uber"},{"capacity":4,"product_id":"d1b0005e-8e33-44f1-b1e5-b3f98138642a","price_details":{"service_fees":[],"cost_per_minute":0.25,"distance_unit":"km","minimum":10.0,"cost_per_distance":1.5,"base":0.001,"cancellation_fee":8.0,"currency_code":"CNY"},"image":"http:\/\/d1a3f4spazzrp4.cloudfront.net\/car-types\/mono\/mono-electric.png","short_description":"Electric Vehicles","display_name":"a","description":"a"}]}
Then, I tried GET /v1/estimates/time, with the SAME COORDINATES and SAME SERVER TOEKN, I made the url like this:
https://api.uber.com/v1/estimates/time?server_token=MY_TOKEN&start_latitude=39.914286&start_longitude=116.461745
But it returns:
{"message":"No authentication provided.","code":"unauthorized"}
If the token has expired it should not work with the Products API which actually is working fine, so I don't think that's the issue. Please help, thanks.
BTW, I am testing Uber API in China in case the location may affect the results here.
The GET /v1/estimates/time endpoint has a regional dependency which is probably why it's not working for the China location. Try it out after creating your app on the China Developer dashboard: https://developer.uber.com.cn/ and using that server token with api.uber.com.cn.
Documentation for this can be found here: https://developer.uber.com/docs/china
The OneNote team recently published a blog post in which they explain how to access data from OneNote notebooks that are stored on SharePoint ('site-hosted notebooks', as they refer to them).
I'm trying to use the API as they describe it, but I'm unable to get it to work. Specifically, the first step is to find out my site collections and site ID using the following API call:
https://www.onenote.com/api/beta/myorganization/siteCollections/FromUrl(url='{full-path-to-SharePoint-site}')
It seems to fail no matter what I do: I tried to put the full path to my SharePoint site with and without 'http://' or 'https://', tried to write my organization name in various ways (with '-my' at the end, and without it), and probably a few other combinations as well - it just doesn't work. I keep getting error 400 / bad request.
Any help would be greatly appreciated.
So ... I had a fairly long correspondence with the guys from Microsoft, and here's what I learned:
If you're using a browser or a browser plug-in to test some of your REST APIs calls, it's not enough to be logged-in as the relevant user. This works for SharePoint and other Office 365 APIs, but not for this OneNote API. You must send "Authorization: Bearer ... " in the request headers.
Probably my stupid mistake, but 'myorganization' in the URL https://www.onenote.com/api/beta/myorganization/siteCollections/FromUrl(url='{full-path-to-SharePoint-site}') is not the name of your organization / domain: it's the literal string 'myorganization'.
Finally, the 'full-path-to-sharepoint-site' should point to https://xyz.sharepoint.com and not to https://xyz-my.sharepoint.com.
This syntax works like a charm for me:
https://www.onenote.com/api/beta/myorganization/siteCollections/FromUrl(url='https://XYZ.sharepoint.com/sites/ala')
How to check, that rest api is enabled in JIRA and it has appropriate version?
I know, that it is possible to request 'api/latest', but if latest installed version isn't compatible with methods, that i call?
To check that it is enabled, (and to disable it if you wish), then you will need to go to the Administration panel of your instance and enable/disable it there. Specifically you need to go to:
Administration > General Configuration > Set Accept remote API calls to either On/Off
To check if REST api is enabled, just go to (change the URL to your own)
https://jira.atlassian.com/rest/api/2/user
and see if the page loads.
I don't think there is a way using the API to get the API version, but you can make the API calls and fallback in case of an error. The coding depends on what you are trying to achieve.
You can find more info about the REST API at:
JIRA REST API Version 2 Tutorial
JIRA REST API documentation
If your stuck on the coding part, search Atlassian answers and SO or ask a question.
Use the /rest/serverInfo endpoint, e.g. /rest/api/2/serverInfo.
This should return a JSON string with JIRA version, e.g.
{
...
"version": "8.x.x",
...
}
View page source of Jira page and search version.
Sample output:
<meta name="application-name" content="JIRA" data-name="jira" data-version="7.9.2"><meta name="ajs-server-scheme" content="http">
I want to get the values of all custom fields for a particular JIRA issue using SOAP API. I have a custom field named 'Phase' having value Decision Pending for a JIRA issue JIRA-123.
I am using JIRA 5.1.3.
I am able to get all the properties of JIRA issue using SOAP API except the value of the custom field for above issue.
I tried following code, but I am not able to use ComponentManager in my code
IssueManager issueManager = ComponentManager.getInstance().getIssueManager();
CustomFieldManager customFieldManager = ComponentManager.getInstance().getCustomFieldManager();
Issue issue = issueManager.getIssueObject("JIRA-123");
CustomField customField = customFieldManager.getCustomFieldObjectByName("Phase");
Object customFieldValue = issue.getCustomFieldValue(customField);
I would highly appreciate if anyone can provide correct approach.
The SOAP API is deprecated by 5.1.3. I suggest you use the REST API - it is both more easy to use and implement.
What is REST?: read here. The basic idea is to bind HTTP request types to actions, it's quite obvious - check this table for a quick run-in.
Jira has a powerful REST API that you can use. This is the main documentation of the current release.
What do you need to do in some high-level steps?:
Set-Up some type of authentication with your JIRA instance. Be it:
Baisc - example
OAuth - example
Get a list of all fields via the API:
The /rest/api/2/field' [method returns a list of all fields][6] - both System and Custom.
Then when you identify the exact field use/rest/api/2/customFieldOption/{id}` to get the full
representation of the Custom Field Option.
I recommend you use a tools like Chrome REST Console ,or anything similar that you can easily make requests with, to get to know the API. The bonus is that you don't need to setUp authentication if you're logged in through the same browser. Your user will require full admin access though.
This is the root of all JIRA REST API docs. Check it out.
If you're doing this in PHP I would personally recommend using some kind of library. I've used
Guzzle (in a CakePHP environment) for this exact task and it turned out very well.
I'm not sure of how do you use the soap API, here is example of using it via the PHP-SOAP:
#!/usr/bin/php -q
<?php
$soapClient = new SoapClient("https://jira.com/rpc/soap/jirasoapservice-v2?wsdl");
$token = $soapClient->login('user', 'password');
$myIssue = $soapClient->getIssue($token,"TES-13");
print_r($myIssue); // all of the issue details
print_r($myIssue->customFieldValues); // get all custom fields
foreach ($myIssue->customFieldValues as $customFieldValue) {
// search for the right custom field
if ($customFieldValue->customfieldId == 'customfield_10402') {
echo $customFieldValue->values[0];
die();
}
}
?>
In case you want to use any other API, have a look at the JIRA Remote API Reference.
A remark regarding the REST and SOAP APIs -To quote from Jira's site the SOAP API "Supported but no future development". The Rest API is still a bit new and there are things you can't yet do with the REST API (example), and can be done easily using the SOAP API.
Well i started of by following all the instructions here:
http://code.google.com/p/xmppframework/wiki/FacebookChatHowTo
I used the recommended fork of the facebook api and tried the latest from:
https://github.com/facebook/facebook-ios-sdk/
My problem starts with the following error:
< failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl">< not-authorized/></failure>
The error is a reply from facebook to xmppframework s response to a authentication challenge. The response that is made by the iphone is base64 encoded msg when i decode it i find 2 of the values are null:
api_key=(null)
and the
session_key=(null)
This is obviously the reason facebook is returning that error. But the problem i have is i cant seem to find any where to set these values in the framework. Besides i think the session_key should be pulled in from facebook anyway.
I guess what i want to know is a couple of things.
Has any one got the xmppframework working with facebook on a iDevice?
If you have got it working did you have to stray from the path of the instructions on http://code.google.com/p/xmppframework/wiki/FacebookChatHowTo ?
do you know of any other method to get facebook chat working on the iphone?
Any suggestions or help for my current dilemma would be appreciated. Happy to share my code if you want.
cheers
I wrote the Facebook integration for XMPPFramework. The api_key and session_key, come from a call to auth.PromoteSession. Facebook is trying to deprecate that call, so to enable it, you must follow step 7, in the HowTo:
Under Migrations, change Disable Deprecated Auth Methods from Enabled to Disabled and Save Changes.