Posts

Showing posts with the label rest api

Firsby for Unit test Firebase REST API

Firebase required to iniciate in order to run test cases. Firsby is a api testing fromwork ,which can work with jasmine.  npm install jasmine-node -g Install frisby.js http://frisbyjs.com/ Create spec file witih spec folder Import depeldancy var request = require("request"); var server = require("./../src/test.js");   // server file var frisby = require('frisby'); Header value for every request frisby.globalSetup({ request: { headers: {'AccessToken':process.env.test_token}. // taken from the .env } }); Dependent Request frisby.create(' Login')   .post(process.env.npm_config_host+'/api/login',{.  //take the host when running test command         "profile-type": "test",         "mess-token":"" }) .after(function(err, res, body) {   frisby.create('Dome')     .post(process.env.npm_config_host+'/api/user',{           "profile-type": &qu

Node Express REST API Document while coding

I have used apidoc in my  Node Express REST Project . It works like charm and cpable to handle document versioning. APIDOC Inline Documentation for RESTful web APIs http://apidocjs.com/#param-api-description 1.npm install apidoc - g 2. /** * @api {get} /tasks/:id Find a task * @apiGroup Tasks * @apiDescription User login + register user if user login for the frist time. * @apiParam {id} id Task id * @apiSuccess {Number} id Task id * @apiSuccess {String} title Task title * @apiSuccess {Boolean} done Task is done? * @apiSuccess {Date} updated_at Update's date * @apiSuccess {Date} created_at Register's date * @apiSuccessExample {json} Success * HTTP/1.1 200 OK * { * "id": 1, * "title": "Study", * "done": false * "updated_at": "2016-02-10T15:46:51.778Z", * "created_at": "2016-02-10T15:46:51.778Z" * } * @apiErrorExample {json} Task not f

Firebase REST API auth - access token

I have to use Firebase Database and server a REST API .I need to allow the REST API call only for authenticated users from the same freebase. According to Documentation on REST API Save data > Auth Section I able to successfully access the Database using database secret . https://firebase.google.com/docs/database/rest/save-data But I could not successfully retrieve the data using access token of authenticated user . https://<<removed-my-project-id>>.firebaseio.com/users.json?access_token=ya29.GlxuBLxJ6R2uNYJ7SXnMhe7Inqw94ShGeZ7MTBmyxYUI2cLDCXJcPAfbo1_uKLjUhfPX3uQw_ElBjIVwu73caeKJfBAh87GGRWZx2JiSwuIZybAmtVXyFyqaeYbAJQ Reffering confusing document again I pass the URL as fallows using the idtoken.(currentUser.getIdToken taken from cleint side) https:// <<my-project-id>> .firebaseio.com/users.json?auth=eyJhbGciOiJSUzI1NiIsImtpZCI6IjBkNWNlYjA1ODA2ODk3OTM3ZTAxNGFjMDNkYWZkODQyMzM4ZjBlNmQifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vZmV0Y2htZS1

Apache enable MOD_REWRITE for PHP Rest API

Image
Hi Im woarking with follwing expample which illustrate how to create REST Api form genic PHP http://www.tutorialsface.com/2016/02/simple-php-mysql-rest-api-sample-example-tutorial/ However I  need to set MOD_REWRITE for the API folder in Wamp and Follwing steps need to follow to achive it . 1.Go to apache  http.conf in WAMP apache folder ,and open it 2. Make a backup of http.conf   3.  Find the line #LoadModule rewrite_module modules/mod_rewrite.so and uncomment it by removing hash. 4.ADD the rule as below for the APi folder . in my case its MI_API (there will be block like below mapped to WAP ,www folder ,you can edit it as nesosary) <directory C:/wamp/www> Options All   AllowOverride All </directory> Thanks  for : https://webdevdoor.com/php/mod_rewrite-windows-apache-url-rewriting