What’s the difference between text/xml vs application/xml for webservice response

From the RFC (3023), under section 3, XML Media Types: If an XML document — that is, the unprocessed, source XML document — is readable by casual users, text/xml is preferable to application/xml. MIME user agents (and web user agents) that do not have explicit support for text/xml will treat it as text/plain, for example, … Read more

Capturing URL parameters in request.GET

When a URL is like domain/search/?q=haha, you would use request.GET.get(‘q’, ”). q is the parameter you want, and ” is the default value if q isn’t found. However, if you are instead just configuring your URLconf**, then your captures from the regex are passed to the function as arguments (or named arguments). Such as: (r’^user/(?P<username>\w{0,50})/$’, … Read more

Should I use Singular or Plural name convention for REST resources?

For me is better to have a schema that you can map directly to code (easy to automate), mainly because code is what is going to be at both ends. GET /orders <—> orders POST /orders <—> orders.push(data) GET /orders/1 <—> orders[1] PUT /orders/1 <—> orders[1] = data GET /orders/1/lines <—> orders[1].lines POST /orders/1/lines <—> … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)