>clear >Local loXmlHttp As "Microsoft.XMLHTTP", lcUrl, postData,userID,id,title,body > >userID=12 >title="From VFP" >body = "This is posted from VFP as a test" > >Text to postData textmerge noshow >{ > "userId":<< m.userID >>, > "title":"<< m.title >>", > "body": "<< m.body >>" >} >endtext > >lcUrl = 'https://jsonplaceholder.typicode.com' > >loXmlHttp = Newobject( "Microsoft.XMLHTTP" ) >loXmlHttp.Open( "POST" , m.lcUrl + '/posts', .F. ) >loXmlHttp.setRequestHeader("Content-Type","application/json; charset=UTF-8") >loXmlHttp.Send( m.postData ) > >? "===================================" >? "Post Test", loXmlHttp.Status >? loXmlHttp.responsetext >? "===================================" > >MessageBox("Continue? API Codes: 200-OK, 201-Created",0,"REST API Test",10000) >clear >m.id = 3 >loXmlHttp.Open( "GET" , Textmerge('<< m.lcUrl >>/posts/<< m.id >>'), .F. ) >loXmlHttp.Send( ) > > >? "Get post with ID X test", loXmlHttp.Status >? loXmlHttp.responsetext >? "===================================" > >MessageBox("Continue? API Codes: 200-OK, 201-Created",0,"REST API Test",10000) >clear > >loXmlHttp.Open( "GET" , Textmerge('<< m.lcUrl >>/posts/<< m.id >>/comments'), .F. ) >loXmlHttp.Send( ) > > >? "Get test post X comments", loXmlHttp.Status >? loXmlHttp.responsetext >? "===================================" >>