Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

david001's avatar

api error response

Hi, I have an api post request I am using Guzzle for this. Each time I make an request i get this error in my browser

Server error: `POST  `500 Internal Server Error` response: {"error":"param is missing or the value is empty: list"}

Below is my code

Route::get('test',function(){

    $headers = [
        'Accept' => 'application/json',
        'Authorization' => 'token b22aa6298f78422a87755cb4bd9f3e37',

        'Content-Type' => 'application/json',

    ];

    $client = new GuzzleHttp\Client([
        'headers' => $headers

    ]);
    $res = $client->request('POST', 'https://go.smartrmail.com/api/v1/lists', [
        'form_params' => [
            'email' => '[email protected]',
           
        ]
    ]);

    echo $res->getStatusCode();
});

Can you help me. I have not done integration before. I have correct api token. I have place token before my token as per the documentation Thanks

0 likes
6 replies
martinbean's avatar

@david001 You need to read the error message. It’s literally telling you what’s wrong:

{"error":"param is missing or the value is empty: list"}

The API endpoint you’re calling is expecting a list parameter, and you’re not supplying it,

Error messages aren’t just random strings of text for you ignore. A developer will have gone to the effort of writing error messages to inform you what went wrong and hints on how to resolve the issue.

2 likes
david001's avatar

@martinbean thanks for reply. I am beginner and never done integration before. I can read the error message but I am not able to understand it. I am passing params as 'form_params' => [ 'email' => '[email protected]', ] What is meant by list, is it { } instead of array ? Thanks

jlrdw's avatar

@david001 doesn't the api documentation have examples of how to request (or post) the data from / to their api, it should.

martinbean's avatar
Level 80

@david001 No. It’s telling you it’s expecting a parameter named list

Consult the documentation for what parameters you should be passing in API calls.

AlexElementarteilchen's avatar

Hi David,

it seems that the error message is a bit confusing.

  • It says that a param is missing and it looks like that param is called 'list'.
  • But I think that what they refer to with 'list' is actually the name of the API endpoint.
  • What they probably mean to say is: Hey there is a parameter missing in the endpoint called 'list'

When you look at the API documentation: https://docs.smartrmail.com/en/articles/636612-manage-subscriber-lists it says that the parameter is called 'title'.

The API endpoint you are calling with the URL https://go.smartrmail.com/api/v1/lists is for creating a new list.

The API documentation gives an example of what it expects as a parameter:

{
  "title": "Newsletter"
}

Which means that in your form_params you should have something like:

{
  "title": "My first newsletter"
}

If you want to add a subscriber to this list, there must be another API endpoint for that.

Please Note!

Be careful when copy/pasting code so you don't share your auth token in a forum!

If that happened you should generate a new one.

1 like

Please or to participate in this conversation.