Support » Plugin: Newsletter » Lists parameter is ignored in an API call

  • Resolved magicgol

    (@magicgol)


    Hello,

    I’m using The Newsletter Plugin with Newsletter API Extension, but I’m unable to perform some calls.

    
    curl -X POST \
      https://...../wp-json/newsletter/v1/subscribe \
      -H 'cache-control: no-cache' \
      -H 'content-type: application/json' \
      -d '{
        "email": "test@email.it",
        "api_key": "(my_api_key)",
        "lists": [2]
    }'

    Performing a call like this, the subscriber is created but not added to the list #2.
    The API Key is correctly added in the admin section, I double checked.

    Am I doing something wrong? Any suggestion?

    Thanks for your support.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Roberto Fietta

    (@webagile)

    Hi, did you check if lists are set as private?
    Regards,
    Roberto

    Hello Roberto,

    Thank you for your fast and kind reply.
    The list #2 is set as “Disabled / Private Use”, under “Visibility” column.

    Do I need to change this setting?

    Best regards,
    Fabio.

    Plugin Author Stefano Lissa

    (@satollo)

    The subscribe endpoint works exactly as a regular subscription from a form, so every list referenced must be public (otherwise one can forge a call entering that list).

    Stefano.

    Hello @satollo,

    Thank you for your reply.

    We tried by setting the list to every option different than “Disabled / Private use” (so we tried with “Only on profile page”, “Hidden”, “Even on sub form”) but our API call — reported on my first post — didn’t work.

    Are we missing something?
    Do we necessarily need to create a subscription form?

    Plugin Author Stefano Lissa

    (@satollo)

    But are you subscribing an existing user or a new one?

    Plugin Author Stefano Lissa

    (@satollo)

    Hi, the api_key, anyway, should not be added to the subscribe call.

    @satollo Thank you.

    We’re trying to subscribe new user(s). We also tried without api_key parameter as you suggested but it didn’t work.

    Plugin Author Stefano Lissa

    (@satollo)

    I’ll have a session today to check the specific problem.

    Stefano.

    Good morning Stefano,

    Thank you.
    Please let us know.

    Plugin Author Stefano Lissa

    (@satollo)

    Hi,
    I’ve just tested and it works. Check if you have the version 2.0.2 of the api addon, version 6.4.0 Newsletter and ensure the list number 2 in your example is marked as public.
    Be sure to make every test with a new email address or delete the test email address every time.

    Could you test it again?

    Thank you, Stefano.

    Hello @satollo,

    After several tests, we noticed that we were using a wrong Content-Type in the request. After setting it to “application/json”, it worked.

    Closing this ticket. Thank you once more to you and your team for the support!

    Best regards,
    Fabio B.

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.