Mailchimp API merge fields - date format - mailchimp-api-v3.0

I am using the Mailchimp API to add a new member.
I have defined a custom merge field called ADDED which is the date I added this member to the list. I want this field to be required when submitting it via the API. I defined it as DD/MM/YYYY format (see below):
This is what my json string looks like:
{
"email_address":"email#server.com",
"status":"subscribed",
"merge_fields":
{"USERLEVEL":"1", "BATCH":"999000", "ADDED":"21/04/2020"}
}
As you can see, my format is indeed `dd/mm/yyyy', but when submitting the API request, I get this error message:
**Your merge fields were invalid: Please enter the date**
{"type":"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/",
"title":"Invalid Resource","status":400,
"detail":"Your merge fields were invalid.",
"instance":"1ad6bc0e-7728-45c1-a308-b751247efb5b",
"errors":[{"field":"ADDED","message":"Please enter the date"}]}
Can anyone explain why I am getting this error, when I do seem to have the correctly formatted date in the request?
Thanks.

OK, it seems that the definition of the field as DD/MM/YYYY might only be for reading purposes. but for submitting, it must be done like this:
"ADDED":"2020-04-21T00:00:00.001Z"

Related

I am trying to get list of estimates from zoho books to zoho creator but its giving me error of data type mismatch

Please check this image for more details and code its simple code but i am getting datatype mismatch error
https://i.stack.imgur.com/rDYH6.png
This is the common format to get list of records in zoho books module.
<variable> = zoho.books.getRecords(<module_name>, <org_ID>, <search>, <connection>);
module_name: Name of the module
org_id: Your organization id
search: specifies the values based on which the records will be filtered. You can specify an empty string or an empty map for this param, in which case all the records will be fetched
connection: Name of the connection
In order to get list of estimates Please do the following,
response = zoho.books.getRecords("Estimates", "54654632", "", "zbooks");
For further clarification refer this document https://www.zoho.com/deluge/help/books/fetch-records.html
If you have any other queries reach out to us at support#zohobooks.com
You are using single quotes for strings which Deluge intercepts as date or date-time strings. Use double quotes instead.
The error shown on the screenshot is caused by the single quote you're using instead of double quotes (").
You can use as following:
data = zoho.books.getRecords("Estimmates","OrganizationID","Connection");

Laravel route query get email address from query value instead of key

I have encountered an issue regarding Laravel 8 routes.
And I am unable to find a solution to this problem.
For example, I have this route format in Laravel:
$domain/password_reset?$email
Where it will look like this:
http://test-website.com/password_reset?test#gmail.com
I am aware that query parameters have ?key=value format. However in my case, the provided route format is what is expected (by client). Not the conventional key=value way. Also, the url link is clicked from an email. Wherein the link in the email uses the exact route format given (not url-encoded).
The sample request query that is fetched in the controller is as follows:
If you would notice, the email became a key (which is expected). And since it is a key, . has been changed to _. Instead of gmail.com it became gmail_com.
Would there be a better solution to get the exact email address from the url (not url-encoded) in this route format? Hopefully someone can help me with this. Thank you very much in advanced!
You should get the request query and parse it yourself:
[$path, $query] = explode('?',$request->fullUrl())
In the exemple above $query should hold everything after ? on the URL.
Alternativelly you can just get the key of the array you already have:
$email = array_keys($request->all())[0]

Dynamics 365 - Get the value for selected option from Global Option Set

I'm trying to find a way to get a value for my field which is based on a GlobalOptionSet.
I'm managing to pull back data from my endpoint
https://TEST.test.dynamics.com/api/data/v9.1/projects which is returning my list of projects.
some of the fields on this dataset just show as GUID's which I've managed to expand into and get their values.
However, some of the fields returned are showing just numbers like 866110000 which I believe is an option in a GlobalOptionSet.
I know I can get the GlobalOptionSet definition and match up its value but I'm hoping to be able to get this information in a single query similar to the way I got other fields by expanding.
Does anyone know how to get it to return the selected Value for an option field instead of the ID of the option that was picked?
Thanks
All you have to do is include the below header to get the needed optionset & lookup display name values. Read more
Prefer: odata.include-annotations="OData.Community.Display.V1.FormattedValue"
Sample request:
GET [Organization URI]/api/data/v9.1/accounts?$select=name,donotpostalmail,accountratingcode,numberofemployees,revenue
&$top=1 HTTP/1.1
Accept: application/json
OData-MaxVersion: 4.0
OData-Version: 4.0
Prefer: odata.include-annotations="OData.Community.Display.V1.FormattedValue"
If its AJAX request using jQuery or XmlHttpRequest, for ex.
req.setRequestHeader("Prefer", "odata.include-annotations=OData.Community.Display.V1.FormattedValue");
Reference

is not a valid value for date

I'm using spring ws 2.0.2.RELEASE
I have a web service that creates a sales order
Two of the elements in the SOAP call are dates:
<ns3:requestedDate>2012-06-06T01:00:00.000+10:00</ns3:requestedDate>
<ns3:orderDate>2012-06-06T10:25:09.681+10:00</ns3:orderDate>
Both fields are defined in the schema as xs:dateTime
When I send through the SOAP call to my service I get:
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring xml:lang="en">Validation error</faultstring>
<detail>
<spring-ws:ValidationError xmlns:spring-ws="http://springframework.org/spring-ws">cvc-datatype-valid.1.2.1: '2012-06-06T01:00:00.000+10:00' is not a valid value for 'date'.</spring-ws:ValidationError>
<spring-ws:ValidationError xmlns:spring-ws="http://springframework.org/spring-ws">cvc-type.3.1.3: The value '2012-06-06T01:00:00.000+10:00' of element 'ns3:requestedDate' is not valid.</spring-ws:ValidationError>
<spring-ws:ValidationError xmlns:spring-ws="http://springframework.org/spring-ws">cvc-datatype-valid.1.2.1: '2012-06-06T10:25:09.681+10:00' is not a valid value for 'date'.</spring-ws:ValidationError>
<spring-ws:ValidationError xmlns:spring-ws="http://springframework.org/spring-ws">cvc-type.3.1.3: The value '2012-06-06T10:25:09.681+10:00' of element 'ns3:orderDate' is not valid.</spring-ws:ValidationError>
</detail>
</SOAP-ENV:Fault>
Any idea why these valid dates are being reported as invalid by Spring?
It seems if I pass in just the date portion '2012-06-06' it all works. I suppose the clue here should have been 'date' as opposed to 'datetime'. The end point being called must be expecting only a date.
Probably the date format. It's parsing the date in the format YYYY-MM-DD but a lot of validators pass what is basically the universally accepted internet format of DD-MM-YYYY. Had similar trouble recently with validating a form in mobile safari. Try changing the date format and see if that works.

How do I properly validate DateTime in a CRUD situation for a model within an MVC project?

I have users selecting a DateTime using a caldendar/clock popup that allows them to make a selection. However, if they were to go in and edit the date to read something like: 6/12/201 10:36:47 AM instead of 6/12/2012 10:36:47 AM my Action gets past the ModelState.IsValid check and I get an error when the Controller attempts to save the object to the database (rightly so).
How do I properly validate DateTime in this situation? (I want to prevent a user from even being able to 'submit' the form if the datetime is not properly formatted)
Note: I currently have in place jquery.validate and typically (fields not DateTime) I use #Html.ValidationMessageFor(model => model.Field) - This does not appear to do anything for my current DateTime fields when they are formatted inappropriately.
you can simply add date client side validator for you DateTime field using snipet like that:
$(element).rules('add', {
date: true,
});
where "element" is your input for DateTime field.
Are you sure you're importing all of the requisite validation js files? it sounds like your server validation is working OK but the client is doing nothing. I suggest reading the following post by Brad Wilson: link

Resources