Title: REST API and permalinks
Last modified: October 18, 2018

---

# REST API and permalinks

 *  Resolved [goranpro](https://wordpress.org/support/users/goranpro/)
 * (@goranpro)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/rest-api-and-permalinks/)
 * Hi,
 * Im doing the code bellow in my REST API call. What i have noticed is that this
   code changes the permalinks(to the one defined in slug) on some products and 
   NOT on some others. Im not sure why. How could i make sure that the permalniks
   are ALWAYS rewriten to the new defined “slug”(or title)?
 * $data = [
    ‘name’ => $productTitle, ‘slug’ => $productTitle, ];
 * $result = $woocommerce->put(‘products/’ . $productId, $data);

Viewing 1 replies (of 1 total)

 *  Plugin Support [mouli a11n](https://wordpress.org/support/users/mouli/)
 * (@mouli)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/rest-api-and-permalinks/#post-10802219)
 * Hi there,
    From your code snippet it looks as if you are updating a products 
   Title and Slug using the REST API. My initial thought is that you are using the
   Product Title as the slug without updating it to make it all lower case and replace
   spaces with `-`. Try using slugs that are correctly formed to see if this is 
   the issue.
 * Good luck with it 🙂

Viewing 1 replies (of 1 total)

The topic ‘REST API and permalinks’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [permalinks](https://wordpress.org/support/topic-tag/permalinks/)

 * 1 reply
 * 2 participants
 * Last reply from: [mouli a11n](https://wordpress.org/support/users/mouli/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/rest-api-and-permalinks/#post-10802219)
 * Status: resolved