how to get yii 1 post method working with postman - php

I am building restful api for android app using postman, but in postman only get method is working
complete code is here https://github.com/arvindsinghs/GT/blob/master/apicontroller
this method work if i sent parameters
$atts = \Yii::$app->request->get();
but if it changed it to post method and try to send paramerts in body it is not working
$atts = \Yii::$app->request->post();
Any help is appreciated.

Related

Requesting Data for call back url

I am new on working third party API, working on GUPSHUP API and with the help of guzzle I am sending msg to whatsapp but for receiving the message from callback url to my controller what should I use.
Notes-> Callback url which i added on is webhook call back URL , Now when any event happened on that url
how to receive that in my laravel controller, i search all the places where they suggested call webhook client server put a route
Route::webhooks('webhook-receiving-url');
in this i have to put my call back url . but i want to receive this call back url in controller , how to do this , please help me out

REST API / DELETE METHOD / Slim Framework v3

I am currently in the process of learning how to buid my own REST API using the Slim Framework v3 for PHP. I found several tutorials and was able to build multiple routes to send GET and POST requests to my MySQL database.
Next up for me is a delete request, but it doesn’t work.
This is my code:
$app->delete('/usuario/[{correo}]', function ($request, $response, $args) {
$sth = $this->db->prepare("DELETE FROM usuarios WHERE email=:correo");
$sth->bindParam("correo", $args['correo']);
$sth->execute();
$todos = $sth->fetchAll();
return $this->response->withJson($todos);
});
I’m testing it in Postman and I always have the same problem: 404 Not found.
I can’t understand it because I think the url is correct (http://localhost:8080/usuario/bbb#bbb.es).
Postman view
Can anyone help me?
I think the problem was in the parameter you sent to the route
You can not send dots as a character in your route URL
IF you test
I guess if you test http://localhost:8080/usuario/bbb#bbbdotes
It will work fine
You can send the email address in the body not in the url
{"email":"bbb#bbbdotes"}
And then you can deal with it like POST route to fetch the email address

How to test rest api written in codeigniter using URL manually

How can I test my rest api via URL?
I copied code from https://github.com/alexmarton/RControl and it only have instruction for get method.
So far what I've tried are :
http://test/api/blog/delete/2?format=json&X-API-KEY=1234
http://test/api/delete/2?format=json&X-API-KEY=1234
You can use Postman to test your APIs with manual data.

wp_remote_get() request failed when requested from certain server

I'm creating a WordPress plugin for my client using WP REST API V2,
and i got a problem with the wp_remote_get() function,
My wp_remote_get() always return "http_request_failed" when I send the get request to the server from the client-side plugin,
BUT its weirdly works well when I try the wp_remote_get() in other domain or when I send the request to other url,
I use this simple code
$allstores = wp_remote_get( 'http://admin.shopsaver.dk/wp-json/wp/v2/shop', array( 'timeout' => 20 ) );
var_dump( $allstores );
Please help :)
Thank you

Retrieve post_impressions from Facebook with PHP SDK

Using the PHP SDK, i'm trying to get post_impressions for specific posts.
I've set a valid default access token using setDefaultAccessToken(), and then im trying:
$request = $fb>get("/$post_id/insights/post_impressions");
$graphEdge = $request->getGraphEdge();
var_dump($graphEdge);
I've also tried to prepend $page_id followed by underscore to the $post_id in the request, as explained here, but no luck.
The response i get from the request above is an object with protected properties with my app_id, secret_id, my request method.
No data about the post though.
Any ideas on what im missing out here?

Categories