Questions tagged [yii2-api]

Yii provides a whole set of tools to simplify the task of implementing RESTful Web Service APIs.Quick prototyping, Response format, data caching and HTTP caching, rate limiting and a lot more. This tag should be used for all Yii2 REST Services based questions.

22 questions
2
votes
0 answers

How to call rest API of Yii2 in Angular 7

I have a Angular service which makes an API call. Here is my subscribe.service.ts file import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http' @Injectable({ providedIn: 'root' }) …
rji rji
  • 697
  • 3
  • 17
  • 37
1
vote
1 answer

Creating migration history table "migration" Syntex error

I have this Error when run pipeline on bitbucket ./yii migrate --interactive=0 Yii Migration Tool (based on Yii v2.0.33-dev) Error: syntax error, unexpected ';' 2020-03-04T05:30:03.930868636Z stdout P Creating migration history table "migration"...…
Faizan Khattak
  • 862
  • 8
  • 22
1
vote
1 answer

Yii2 Api - Using Oauth to authenticate user and website?

I am building a service which handle content from different websites. Each website has their own users. So I need to authenticate the website which is accessing my API and I need to authenticate the user who is logging in from that website. Since…
Eduardo
  • 1,781
  • 3
  • 26
  • 61
1
vote
1 answer

oAuth2 security issue with clinet_id and secret key : user can press inspect element and earn clinet_id and secret key

I write a rest api with yii2 and i am using oAuth2 , the problem is when user want login , client web application should send request to get token , request should contain client_id and secret_key and username and password in this case user can…
zia
  • 278
  • 1
  • 10
1
vote
1 answer

Yii2 RESTful: Content Negotiation languages not work

I implemented a structure of API Rest with the models in Yii2. Everything works great for actions (index, create, update etc ...) and methods (GET, POST, PUT etc ..) but I have a problem with the ContentNegotiator class. Specifically, if I pass as a…
Alberto Favaro
  • 1,824
  • 3
  • 21
  • 46
1
vote
0 answers

angular2 service request header response for X-Pagination-Page-Count

I am using angular2 service to get data response from yii2 api. In browser network tab it showing all required response but when I am trying to get it directly from component like response.headers.get('X-Pagination-Page-Count') Then it's not…
Anil Kumar
  • 701
  • 11
  • 28
1
vote
1 answer

Custom action in Action with id in Rest ActiveController Yii2

Trying to implement a GET method in Rest API, to query the user status e.g. GET user/:id/status So getting the status of user id #1 would call /user/1/status In config I have: 'urlManager' => [ 'enablePrettyUrl' => true, 'enableStrictParsing'…
keeg
  • 3,990
  • 8
  • 49
  • 97
1
vote
0 answers

yii2 rest - using PUT to update data

I am using a REST API in Yii2 with Authorization Bearer I have configured the actionUpdate completely but somehow when using PUT to update the data, I am getting null value when I try to get the post data,…
kasmawati
  • 51
  • 2
  • 9
1
vote
1 answer

Twitter API : Not Getting User Email - Yii2

I'm getting error like Unknown Property – yii\base\UnknownPropertyException Setting unknown property: yii\authclient\clients\Twitter::requestEmail Whenever I am including 'requestEmail' => 'true', in 'authClientCollection' => [ for components in…
Nana Partykar
  • 10,556
  • 10
  • 48
  • 77
0
votes
1 answer

Fetch users data with related clients data in Yiii2 api

I need to get an API response, where each client row has its associated users' data in it. like this: clients: [ { id: 1 name: 'client_1', users: [{ id: 1, name: 'user_1', clients_id: 1}, { id: 2, name: 'user_2', …
Darshan Soni
  • 21
  • 1
  • 9
0
votes
0 answers

How to serve index.php from different directory through .htaccess?

I am working on a project which is in Yii2. I have to integrate swagger UI for API documentation. My current directory structure: current directory structure This is what the .htaccess looks like: RewriteEngine on RewriteCond %{REQUEST_FILENAME}…
0
votes
1 answer

Unable to pass post variables in http request from Electron to Yii API

I want to make API (Get & Post) requests to an API build with Yii2 using Electron. I have tried Axion, Fetch, HTTP, request modules and all of them gave me the same error: data: { name: 'PHP Notice', message: 'Undefined index: username', code:…
0
votes
2 answers

Yii2 : Rest API return xml instead of json

I just used Yii2 to build an Application to be backend for Flutter App so .. I created a modules/api folder and I've create controllers inside it , like this
Naeem Ali
  • 322
  • 1
  • 4
  • 22
0
votes
2 answers

Get all attributes of extraFields in Yii2

To get attribute from extraFields() url is like organizations/6/location?expands=address,city (i have 10 attribute) But how can i get all these at once from extraFields() something like this organizations/6/location?expands=true or all This…
Bell Carson
  • 127
  • 9
0
votes
1 answer

Override response of Rest authentication(HttpBearerAuth) in yii2

I have token based authorization, for which i have did below changes. In User model, override findIdentityByAccessToken() method as below. public static function findIdentityByAccessToken($token, $type = null) { $userlogin =…
Yasin Patel
  • 5,624
  • 8
  • 31
  • 53
1
2