Skip to content
Advertisement

Tag: rest

Using Guzzle to retrieve API via (POST), unable to pass JSON parameters for query

I have created an API request, it connects to the server fine and passes basic authentication. The error I receive is “Uncaught GuzzleHttpExceptionClientException: Client error: POST http://my.api.com/dest/addr resulted in a 400 Bad Request response: {“code”:400,”result”:”Missing customer id” I have tried many ways to pass the query parameters and none of them have worked. I checked to make sure the JSON

PHP json_encode to C# Object unable to convert

I have this array of objects that contains some strings and an array of strings that I want to return from my server: “[{“original_file_name”:”Plain_HAIR.pdf”,”encrypted_file_name”:”UTTSJG13V1EC46J.pdf”,”is_successful”:true,”message”:””,”email”:”[“testuser@gmail.com”]”,”doctype”:”HAIR”}]” On my local app, I have a class that looks like this: The issue is that when it comes back to the local app, I get an error saying : {“Error converting value “[{“original_file_name”:”Plain_HAIR.pdf”,”encrypted_file_name”:”UTTSJG13V1EC46J.pdf”,”is_successful”:true,”message”:””,”email”:”[“testuser@gmail.com”]”,”doctype”:”HAIR”}]” to type

api versioning page not found

I’m trying to create my 1st API on Laravel 8, and want to create versioning that would look like this My user controller looks like this in my config/app.php i have this ‘api_latest’ => ‘1’, in my middleware (appHttpMiddlewareAPIVersion.php) in my kernal (app/http/kernel.php) in my /app/Providers/RouteServiceProvider.php and in my routes/api_v1.php i have this I’m getting a 404 error when i

What are the ways of sending images to my server?

I’m mostly a PHP backend / HTML/CSS frontend developer, so I’ve always sent images to my server from the client using either form enctype: multipart/formdata or through a FormData object when uploading through ajax requests. After that I would receive the file in the $_FILES array. Lately I’ve been working with REST APIs and I’ve been doing some research about

Can’t perform a PHP POST request on mysql database

I’m struggling into do my first API in php and I’m facing some problems with a simple POST request. I’ve searched almost everywhere for some alternatives to my code, but it seems to be ok. Can you guys check it for me the last time? Thank you! method: create.php: Answer ok, so I managed to resolve with this code in

Generate unique code every six hour with wordpress rest api

I want to generate 12 digit unique code with wordpress rest api which refresh every six hours. I didn’t find any code or method for my requirement. Example URL: ….domainname.com/wp-json/astra-sites/v1/get-last-unique-code Json code on above link: This code refresh every six hours. Please give me code or details to generate same code which refresh every six hours. I know how to

Alternative to wp_update_post() in WordPress REST API

I’m a beginner and I’m trying to write a Wordpress Plugin in PHP to auto-update content on multiple pages. I managed to make it work, it updates correctly, however it breaks multiple page options (controlled by the theme). I believe it’s caused by the wp_update_post() function. I’m looking for the REST API equivalent of this, since it works successfully when

How make a many-to-many rest API in yii2

I’m trying to get a many-to-may relationship to work, but I can’t get it to work. I have a database with 3 tables: users, favorites & videos. The favorites table contains 2 foreign keys that point to the users table and the videos table. Currently I have the following: User Model: Video Model: VideoController: (ActiveController) Following what they did in:

Advertisement