Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7854571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:06:18+00:00 2026-06-02T20:06:18+00:00

I am trying to figuring out about REST method. I watched few videos from

  • 0

I am trying to figuring out about REST method. I watched few videos from google conference about REST technology but what I saw was app’s implementation of connectivity with database. So I would like to know if my code would count as a REST.

PHP code:

<?php
mysql_connect("localhost","*****","********");
mysql_select_db("********");
$cname = mysql_real_escape_string($_REQUEST['cname']);
$q=mysql_query("SELECT mdl_course_sections.summary FROM mdl_course, mdl_course_sections WHERE mdl_course.id = mdl_course_sections.course AND mdl_course.fullname = '$cname' AND mdl_course_sections.section > 0");
while($e=mysql_fetch_assoc($q))
    $output[]=$e;
print(json_encode($output));
mysql_close();
?>

JAVA code:

public class CourseSegmentsActivity extends ListActivity{

String courseName = null;
String segmentName = null;

@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);

    Intent i = getIntent();
    courseName = i.getStringExtra("courseName");

    ArrayList<HashMap<String,String>> myCoursesList = new ArrayList<HashMap<String,String>>();
    ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
    nameValuePairs.add(new BasicNameValuePair("cname",""+courseName));

    InputStream is = null; 
    String result = null;
    try{
            HttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new HttpPost("****************");
            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
            HttpResponse response = httpclient.execute(httppost);
            HttpEntity entity = response.getEntity();
            is = entity.getContent();
    }catch(Exception e){
            Log.e("log_tag", "Error in http connection "+e.toString());
    }
    try{
            BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-10"),8);
            StringBuilder sb = new StringBuilder();
            String line = null;
            while ((line = reader.readLine()) != null) {
                    sb.append(line + "\n");
            }
            is.close();

            result=sb.toString();
    }catch(Exception e){
            Log.e("log_tag", "Error converting result "+e.toString());
    }

try{
    JSONArray jArray = new JSONArray(result);
    for(int ii=0;ii<jArray.length();ii++){
            JSONObject json_data = jArray.getJSONObject(ii);
            segmentName = json_data.getString("summary");

            HashMap<String,String> map = new HashMap<String, String>();
            map.put("summary", segmentName);
            myCoursesList.add(map);
    }
} catch(JSONException e){
    Log.e("log_tag", "Error parsing data "+e.toString());
}
ListAdapter adapter = new SimpleAdapter(this, myCoursesList,R.layout.course_segments_list_layout,
        new String[] {"summary"}, new int[] { R.id.name});

setListAdapter(adapter);


}
}

If not what I am missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T20:06:20+00:00Added an answer on June 2, 2026 at 8:06 pm

    No, you are NOT. if you follow REST standards, you should be using http protocol efficiently. As per REST standard,

    if you are reading data – use GET
    if you are reading meta-data – use HEAD
    if you are writing data – use POST
    if you are modifying data – use PUT
    if you are deleting – use DELETE,

    please refer to the w3c specification of http protocol(RFC2616) for further info.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to learn about MYSQL Joins but am having trouble figuring this
I've been trying to figuring this out for the last few hours, and I'm
Working on figuring out my NullPointerException within my custom simplecursoradapter when trying to refresh
I'm trying to learn the MapKit with Monotouch and I'm having difficulty figuring out
I am trying to reverse-engineer a website I don't own, figuring out how some
I'm sure this is really simple but I haven't had much luck figuring out
This should be easy, but I'm having trouble figuring out how to zoom an
I'm trying to learn some javascript and i'm having trouble figuring out why my
I am trying to copy values directly from one mysql table to another... but
Trying to use this method (gist of which is use self.method_name in the FunnyHelper

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.