Title: Rest API
Last modified: December 1, 2018

---

# Rest API

 *  [michelefaccini](https://wordpress.org/support/users/michelefaccini/)
 * (@michelefaccini)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/rest-api-44/)
 * Hi all, I’m trying to use the rest api but I get the following :
    <!DOCTYPE HTML
   PUBLIC “-//IETF//DTD HTML 2.0//EN”> <html> <head> <title>404 Not Found</title
   > </head> <body> <h1>Not Found</h1> <p>The requested URL /sito2/Wordpress/wp-
   json/wp/v2/posts/ was not found on this server.</p> <hr> <address>Apache/2.4.18(
   Win64) PHP/5.6.36 Server at localhost Port 80</address> </body> </html>
 * What did I do wrong ? I’m using postman to send the GET request
    -  This topic was modified 7 years, 8 months ago by [michelefaccini](https://wordpress.org/support/users/michelefaccini/).

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [Christopher Spires](https://wordpress.org/support/users/boda1982/)
 * (@boda1982)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/rest-api-44/#post-10937320)
 * Are you making the GET request against the **_path_** `/sito2/Wordpress/wp-json/
   wp/v2/posts/`? Or the **_URL_** for the posts endpoint (`yourdomain.tld/wp-json/
   wp/v2/posts/`)?
    -  This reply was modified 7 years, 8 months ago by [Christopher Spires](https://wordpress.org/support/users/boda1982/).
    -  This reply was modified 7 years, 8 months ago by [Christopher Spires](https://wordpress.org/support/users/boda1982/).
 *  Thread Starter [michelefaccini](https://wordpress.org/support/users/michelefaccini/)
 * (@michelefaccini)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/rest-api-44/#post-10938236)
 * I’m making the GET request against the URL so [http://www.michelefaccini70.no-ip.org/sito2/Wordpress/wp-json/v2/posts/](http://www.michelefaccini70.no-ip.org/sito2/Wordpress/wp-json/v2/posts/)
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/rest-api-44/#post-10939247)
 * You are not using “pretty” permalinks, so use [http://www.michelefaccini70.no-ip.org/sito2/Wordpress/index.php?rest_route=/wp/v2/posts](http://www.michelefaccini70.no-ip.org/sito2/Wordpress/index.php?rest_route=/wp/v2/posts)
 *  [Christopher Spires](https://wordpress.org/support/users/boda1982/)
 * (@boda1982)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/rest-api-44/#post-10939254)
 * Ah, I see the problem. You’re using the default permalink settings. You have 
   two options:
    - Use one of the “pretty” permalink options ([docs here](https://codex.wordpress.org/Settings_Permalinks_Screen)),
      or…
    - If you want to keep the default permalink settings, manually specify the route
      using `?rest_route=/wp/v2/posts/`(example below, [more info here](https://developer.wordpress.org/rest-api/extending-the-rest-api/routes-and-endpoints/#routes-vs-endpoints))
 * Example of the second option:
 * [http://www.michelefaccini70.no-ip.org/sito2/Wordpress/?rest_route=/wp/v2/posts/](http://www.michelefaccini70.no-ip.org/sito2/Wordpress/?rest_route=/wp/v2/posts/)
 *  Thread Starter [michelefaccini](https://wordpress.org/support/users/michelefaccini/)
 * (@michelefaccini)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/rest-api-44/#post-10940345)
 * Thanks a lot…it works ! Now next step for me is to register automatically my 
   users to WordPress as they register to my site.I installed WP REST User plugin(
   see the following link : [https://wordpress.org/plugins/wp-rest-user/](https://wordpress.org/plugins/wp-rest-user/))
   and now I have to figure out how to use it (not a programmer…).
    -  This reply was modified 7 years, 8 months ago by [michelefaccini](https://wordpress.org/support/users/michelefaccini/).
 *  Thread Starter [michelefaccini](https://wordpress.org/support/users/michelefaccini/)
 * (@michelefaccini)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/rest-api-44/#post-10940523)
 * The following seems to work :
 *     ```
              /* register user to WordPress */
   
   
       $json_string_data = '{"username" : "'.$usrnm. '", "password" : "' . $password . '", "email" : "' . $email . '"}';
       $ch = curl_init('http://www.michelefaccini70.no-ip.org/sito2/Wordpress/?rest_route=/wp/v2/users/register');
       curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
       curl_setopt($ch, CURLOPT_POSTFIELDS, $json_string_data);
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
       curl_setopt($ch, CURLOPT_HTTPHEADER, array(
           'Content-Type: application/json',
           'Content-Length: ' . strlen($json_string_data))
       );
       $result = curl_exec($ch);
       ```
   
    -  This reply was modified 7 years, 8 months ago by [michelefaccini](https://wordpress.org/support/users/michelefaccini/).
    -  This reply was modified 7 years, 8 months ago by [bcworkz](https://wordpress.org/support/users/bcworkz/).
      Reason: code fixed
 *  Thread Starter [michelefaccini](https://wordpress.org/support/users/michelefaccini/)
 * (@michelefaccini)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/rest-api-44/#post-10940574)
 * Now next step for me is to login in automatically my users to WordPress as they
   are logged in to my site.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Rest API’ is closed to new replies.

## Tags

 * [file not found](https://wordpress.org/support/topic-tag/file-not-found/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 7 replies
 * 3 participants
 * Last reply from: [michelefaccini](https://wordpress.org/support/users/michelefaccini/)
 * Last activity: [7 years, 8 months ago](https://wordpress.org/support/topic/rest-api-44/#post-10940574)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
