This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 6 replies, has 2 voices.

Last updated by Bruno 1 year ago.

Assigned support staff: Bruno.

Author Posts
September 22, 2018 at 8:17 am

miteshs

Hello,

We are getting the error with WPML on API

We have used WordPress REST API – OAuth 1.0a Server plugin for authorization.
https://wordpress.org/plugins/rest-api-oauth1/
Our API Working fine but when we try translation with the query string. please check below link
hidden link
hidden link
We are getting OAuth signature does not match error.
Same way
We have used one plugin WooCommerce Currency, Switcher
https://wordpress.org/plugins/woocommerce-currency-switcher/
When we pass currency in the URL query string, it's working.
please check below link
hidden link
hidden link

So we face authorization issue with WPML please check and please help us.

For test API you need to install Postman Software
hidden link
hidden link
hidden link

Let us know if you want more details regarding this issue from our side or any help to replicate the issue etc.

September 24, 2018 at 10:02 pm #2761871

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

Thank you for contacting us. From what I understand you're wanting to create/update a product using the WP Rest API?

If so, you need to follow the steps in our documentation: https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/

For this to work correctly, WooCommerce Multilingual uses hooks to allow the language to be set correctly. Please, could you check the steps in our documentation to see if this works properly?

Please, let me know if I can help with any other questions you may have. I'll be happy to help.

Thank you.

September 25, 2018 at 5:39 am #2762532

miteshs

Hello,

Thanks for your reply.
Sorry to say but you have not understood our issue.
We have created a custom API for our mobile application.
For authorization, we have used WordPress REST API – OAuth 1.0a Server plugin.
https://wordpress.org/plugins/rest-api-oauth1/

Please download our duplicator copy for check our issue.
When we call our custom API with OAuth parameters
Consumer key, Consumer Secret, Access token, Token Secret
hidden link
For example, here we have call products API
hidden link
You can see in above link it's working.
But, When we pass the lang parameter in our API. We face the error. Please check below link.
hidden link
This is the issue.

For testing API you need to download Postman Rest API client Software ( Please download and install this software )
hidden link
hidden link
hidden link

Now we have used currency switcher plugin which has the same functionality( Pass currency parameter in URL ) for convert currency.
With this plugin our API working with URL query String.
Please check below links.
With query String ( hidden link )
Without query String ( hidden link )

Let us know if you want more details regarding this issue from our side or any help to replicate the issue etc.

September 25, 2018 at 9:01 pm #2765246

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

Thank you. I installed the Duplicator package that you made available and I saw what you are reporting. I'll contact 2nd tier support so they can check it out.

As a workaround, you can use the URL format as a directory. This works correctly. To do this, follow the steps below:

- Click on the WPML > Languages > Language URL format
- Select the "Different languages in directories" option
- Click on the "Save" button

The URL to call on the secondary language is site.com/es/wp-json/pgs-woo-api/v1/products/

Please, note that I think this is not a bug, but rather a compatibility issue and may need custom coding, which is beyond the scope of our support.

I'm going to forward this to 2nd tier support so they can check it out.

Thank you.

September 28, 2018 at 1:42 pm #2774092

miteshs

Hello,

We are waiting for your response.
Let us know if you want more details regarding this issue from our side or any help to replicate the issue etc.

October 1, 2018 at 8:15 pm #2779440

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

I have forwarded your ticket to the 2nd tier support so they can check it out.

At the moment, as a workaround and as explained above you can use the format of the URL by directories, which should work correctly. If 2nd tier support suggests some workaround, I'll keep you posted.

Thank you.

October 8, 2018 at 1:59 pm #2796311

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

Our compatibility team is checking this issue, and the recommended one should really be pretty URLs (URLs by directories), rather than using URLs parameter.

Is there any reason you do not want to use pretty permalinks for your site's languages? Fixing this to use languages per parameter should be complicated, as it seems that this plugin has not been updated for more than 2 years.

Thank you.

The topic ‘[Closed] Not working with WordPress REST API – OAuth 1.0a Server plugin API’ is closed to new replies.