Comments (9)
I'll have a look at the filters and check it's not API related, thanks for bringing this up
from mailjet-gem.
I've done few tests with curl against the contact resource.
Using filters works with query string but not with json payload. Maybe this could explain the issue.
The API documentation is not really explicit around this.
from mailjet-gem.
Awesome - thanks for that, we'll look into it.
Much appreciated.
from mailjet-gem.
Ah, ok, I see what's happening here - when you use:
Mailjet::Contact.all('ContactsList' => remote_list.id)
#or
Mailjet::Contact.all(:contactslist => remote_list.id)
The filters passed in are formatted into a query string by the gem.
When the filters are correctly formatted:
https://api.mailjet.com/v3/REST/contact?contactslist=1
You get the required response.
When the filters are incorrect, the API ignores them, for instance if a raw API call is something like:
# A GET to:
https://api.mailjet.com/v3/REST/contact?contcatlis=1
It then defaults to what is effectively:
Mailjet::Contact.all
And you get the 'all' call for the resource.
I think implementing filter checking could be quite challenging as there are so many over so many resources, so it might be best to add a note to the readme.
You are correct, the API does not support filtering by JSON payload.
Hope that helps, all the best,
Toby
from mailjet-gem.
What lead to confusion is this : https://github.com/mailjet/mailjet-gem#naming-conventions
When I use :contact_list
as a filter I expect it to be sent as ContactList
and the query should succeed.
The issue I think is that filters are not converted to camelcase.
from mailjet-gem.
You're quite right - I'll have a look through previous commits and see what changed.
from mailjet-gem.
Hi !
Sorry for the delay, and thanks for that relevant issue. You might take a look at the filters
branch, which we are soon going to release into master
. It automatically convert :snake_case_symbols
into 'CamelCaseString'
so both of your examples would work !
You may need to consider a few days before the merge, but you can already use the feature.
Regards,
Guillaume
from mailjet-gem.
Hi @Electron-libre !
If you have any other suggestion, i would be happy to help ! Otherwise, please consider closing the issue :)
Regards,
Guillaume
from mailjet-gem.
Hi,
Sounds great. Thanks for your feedback and fixes.
Kind Regards
from mailjet-gem.
Related Issues (20)
- How to get total count ? HOT 3
- Release new gem version HOT 1
- FATAL -- : [12421295-5b4a-4afa-828e-166f88779600] Net::OpenTimeout (execution expired): HOT 2
- Random 404 Errors HOT 1
- undefined method `merge' for nil:NilClass HOT 1
- Autoloading and Reloading Constants HOT 1
- error 400 while sending HOT 1
- Send a mail with template: error in template language HOT 1
- Rails integration causes an "Initialization autoloaded the constants ActionText::ContentHelper" warning HOT 1
- ActionMailer + Campaigns? HOT 1
- formatted_payload in resource.rb returns incomplete hash HOT 1
- Cannot change delivery method options after initialization of APIMailer HOT 2
- Setting `from` and `reply_to` to `nil` or `''` causes 400 Bad Request HOT 1
- Support for API v4 - SMS API HOT 2
- Possible bug in the `Mailjet::Send.create` method HOT 1
- Read only attribute causing NoMethodError (undefined method `map' for nil:NilClass) HOT 2
- I'm facing the same issue with just a basic hello world email template. HOT 1
- How to use Send API v3.1 and REST API v3 at the same time? HOT 1
- Remove password and API key from exception
- YAJL/json_gem replaces `JSON` in the whole application (not only in the mailjet-gem's context) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mailjet-gem.