Skip to content
Advertisement

param is missing or the value is empty laravel

I am creating a user with the api provided. I am using Laravel and trying to store data to smartrmail and docs to create new subscriber is here https://docs.smartrmail.com/en/articles/636615-list-subscribers Each time i send request i get following error:

JavaScript

{“error”:”param is missing or the value is empty: subscribers”}

I am using Laravel and my code is here

JavaScript

Anybody help me to figure out what is wrong here. I am following this docs https://docs.smartrmail.com/en/articles/636615-list-subscribers to create a new subscriber

Advertisement

Answer

Instead of

JavaScript

use

JavaScript

Explanation

You want to send json data (I assume that because you set header 'Content-Type' => 'application/json', which means that you are sending json), but form_params is used for application/x-www-form-urlencoded.

json sets header to application/json and sends data as json.

As you set proper header, this should work too:

JavaScript

Proper name of param you can find in Guzzle docs, I used uploading data part.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement