i was trying create a visualforce page from Developer Console using Tooling API ( REST Service ). I checked the documentation it doesn't clarify about the parameters which needs to be present. Whenever i make a call i am getting Status as "Bad Request". I guess i am missing to send some information but i am not able it figure it out.
Please find the code below using which i'm trying to create Visualforce Page.
String salesforceHost = System.Url.getSalesforceBaseURL().toExternalForm();
String url = salesforceHost + '/services/data/v29.0/sobjects/ApexPage';
HttpRequest req = new HttpRequest();
String classBody = '<apex:page></apex:page>';
req.setMethod('POST');
req.setEndpoint(url);
req.setHeader('Content-type', 'application/json');
req.setHeader('Authorization', 'OAuth ' + UserInfo.getSessionId());
req.setBody('{'+
'"Body" : "' + classBody +'"'+ '"Name" : "MyNewVFPage"' + '}');
Http http = new Http();
HTTPResponse res = http.send(req);
System.debug(res);