Comments (5)
Hi @sicoa,
Thanks for reaching out here again. We're glad to see you're exploring deeper and deeper our API.
About your first question, have you already visited the dedicated section for this method in our API guides? It's here http://dev.mailjet.com/guides/#managecontactslists
About your second question, can you post the full code (adding formatting, thanks to Github flavoured Markdown). Here, I'm missing the part where you're actually execute the request via client.post(request)
.
Thanks!
from mailjet-apiv3-java.
Thank you for the quick reply Mr Breton
I would like to see how to use the java wrapper for these functions.
Maybe i am doing something wrong.
The client.post(request) is the exact next line :) I just omitted it considering the call granted, my bad.
Request:
{"Action":"","Filters":"{}","Action ID":0,"Resource":"contact","ID":1504485533,"Body":"{"ContactsLists":[{"Action":"addforce","ListID":"1"}]}"}
Response
{"Status":405,"ErrorInfo":"","ErrorMessage":"Method not allowed","StatusCode":405}
Code (is this correctly stated?):
request = new MailjetRequest(Contact.resource, id)
.property(ContactManagecontactslists.CONTACTSLISTS, new JSONArray()
.put(new JSONObject()
.put("ListID", listsArray[i])
.put("Action", action)));
response = cl.post(request);
from mailjet-apiv3-java.
@sicoa, you're welcome!
Thanks for taking the time to format it correctly, appreciated!
After digging deeper here, I've figured out what's going wrong here: the resource to invoke here is not Contact
but ContactManagecontactslists
. This code snippet to build the request object should then work better:
request = new MailjetRequest(ContactManagecontactslists.resource, ID)
.property(ContactManagecontactslists.CONTACTSLISTS, new JSONArray()
.put(new JSONObject()
.put("ListID", "ListID_1")
.put("Action", "addnoforce"))
.put(new JSONObject()
.put("ListID", "ListID_2")
.put("Action", "addforce")));
Please let us know how this works for you!
Best,
Arnaud.
from mailjet-apiv3-java.
It did work alright!
It needs the ID of the contact referring to ContactManagecontactslists.resource
. That was the missing piece. I suppose this line of thought applies to the rest of the similar calls.
Thank you very much for your accurate help.
Best wishes
sicoaDev
from mailjet-apiv3-java.
@sicoa, glad to hear it works!
Yes, the general logic of our wrapper is to consider action endpoints (like here /contact/:id/managecontactslists
as a resource. This logic can indeed be applied to the other available resources' actions.
Best,
Arnaud.
from mailjet-apiv3-java.
Related Issues (20)
- Release 5.2.1 not tagged and not published to maven HOT 5
- Cannot access Client Options
- Constant for "Globals" missing in Emailv31. HOT 1
- Send Mail With JDK11 HttpClient? HOT 1
- CVE-2020-29582: Information exposure HOT 1
- Csvimport.DATA does not exist HOT 2
- java.lang.NoSuchMethodError: kotlin.collections.ArraysKt.copyInto([B[BIII)[B HOT 6
- Certificate issue HOT 1
- Patch org.json:json@20220320 to fix CVE-2022-45688 HOT 1
- com.mailjet.client.errors.MailjetUnauthorizedException: Unauthorized HOT 1
- Contactstatistics: JSONException: JSONObject["Contact"] not found. HOT 2
- Message Result 'To' is null HOT 2
- Passing variables to templates does not work.
- Socket Exception HOT 2
- New vulnerability in org.json (https://nvd.nist.gov/vuln/detail/CVE-2023-5072#VulnChangeHistorySection) HOT 1
- SocketTimeoutException HOT 1
- delete customer 401 Unauthorized HOT 1
- update customer by ID 404
- Certificate Issue
- 429 errors should get a http header in the response with timestamp for the next time slot
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-apiv3-java.