Giter Club home page Giter Club logo

rest-test's Introduction

REST Test

This contains the FLOW3 package "Wwwision.Rest" that demonstrates a simple REST API.

Installation

  1. Clone this package to the Packages/Application of your FLOW3 distribution:
git clone git://github.com/bwaidelich/REST-Test.git Wwwision.RestTest
  1. Activate the package:
./flow3 package:activate Wwwision.RestTest
  1. Apply Doctrine migrations:
./flow3 doctrine:migrate
  1. Activate the package SubRoutes by copying the following snippet on top of your Configuration/Routes.yaml file:
##
# Wwwision.RestTest SubRoutes
#
-
 name: 'Wwwision.RestTest'
 uriPattern: '<RestTestSubroutes>'
 subRoutes:
   RestTestSubroutes:
         package: Wwwision.RestTest

Usage

You can test the REST API by pointing your browser to:

http://localhost/products

The example allows you to simple CRUD operations on "products" via XML, JSON or the Non-Ajax-Fallback. For this example, jQuery is used to fire the GET/POST/PUT/DELETE requests, but you can of course use any REST-capable client.

Just make sure to set the right request headers: If you want to retrieve the result of an operation as XML (recommended format), you should set the Accept header to application/xml (or any other xml mime type). For json set it to application/json (or any other json mime type).

Also you have to specify the Content-Type header! Set it to application/xml if you want to push content as XML or application/json if you prefer JSON. If the request type can't be determined the input stream is expected to be url encoded (application/x-www-form-urlencoded).

rest-test's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.