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”:”M…
Tag: rest
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”…
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) …
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’…
Basic question about REST APIs enpoint creation and access and how to create an app script
I’ve been recently learning about REST APIs (concretely using MySQL and PHP) so it’s hard for me to understand basic concepts since most of the sites I check have more advanced solutions. My doubt is the following: I know that an endpoint is the place where we get the data, but I’m not sure …
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 r…
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 c…
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 loo…
How do I insert meta data to my customers in woocommerce using an object array?
Hi I am trying to use the woocommerce API and do post requests of customer data and adding an internal customer ID. Here is my data I have tried to pass this data through a post request Below is the response when I commented out the meta data. But as you can see there is a meta data array. But
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:…