I got a problem with the v3 of api meetup.com
Trying to request the api:
GET https://api.meetup.com/find/upcoming_events?sign=true&key=VALID-API-KEY&lon=32.97&page=1000&lat=4.95&page=20&offset=0&end_date_range=2018-07-19424:00:00
Expected behavior:
HTTP/1.1 400 error
{
"errors": [
{
"code": "end_time_range_error",
"message": "end_time_range is not a valid time",
"field": "end_time_range"
}
]
}
Actual behavior:
HTTP/1.1 200 success
{
[...]
}
From the docs:
end_date_range: Return events that start before this date. The date
must follow this format: YYYY-MM-DDTHH:MM:SS.
https://www.meetup.com/de-DE/meetup_api/docs/find/upcoming_events/?uri=%2Fmeetup_api%2Fdocs%2Ffind%2Fupcoming_events%2F
So it is all about:
from the docs: YYYY-MM-DDTHH:MM:SS
from my request: 2018-07-19424:00:00
Any hints?
Hopefully, it's not too late for an answer to this question. If so, maybe this would be helpful for somebody else.
The correct format for this one is 2018-07-19T16:00:00
Related
When providing the incorrect format of a field for a request to my application if the type throws an error then the error message returned by micronaut is vague.
E.G two scenarios
public class fakeClass {
#NotNull
private String fakeName;
}
if my request is {"fakeName": ""}
then the response, correctly, would be something like
{
"violations": [
{
"field": "create.fakeClass.fakeName",
"message": "must not be blank"
}
],
"type": "https://zalando.github.io/problem/constraint-violation",
"title": "Constraint Violation",
"status": 400 }
But lets say my class looks like this:
public class fakeClass {
#Format("yyyy-MM-dd")
private LocalDate exampeDate;
}
With an invalid date or incorrect format of {"exampleDate": 202222--01-01} or {"exampleDate": 2022/01/01}
Then the error message is
{
"type": "about:blank",
"parameters": {
"path": "/project"
},
"status": 400,
"detail": "Required argument [fakeClass fakeClass] not specified"
}
Is there a simple way to provide more information to the error message to make it clear why the request failed for an invalid format or type like #NotNull or #NotBlank?
The problem here is not Micronaut but your payloads. The examples you mentioned are invalid JSON documents.
For example this on here is invalid, since the value is not a number nor a string.
{
"exampleDate": 202222--01-01
}
this would be the a valid variant
{
"exampleDate": "202222--01-01"
}
Make sure you send the date as a String. In your case this is expected to be valid.
{
"exampleDate": "2022-11-01"
}
In general it is recommended to send date using the ISO-8601 format, which you did (yyyy-MM-dd). Furthermore I recommend to apply a global configuration rather than using on each POJO a #Format("yyyy-MM-dd") annotation.
jackson:
dateFormat: yyyyMMdd
timeZone: UTC
serializationInclusion: NON_NULL
serialization:
writeDatesAsTimestamps: false
#Format("yyyy-MM-dd") is a formatter not a Constraint.
You can use #Pattern(<regex>). There is also date specific ones like #Past, #PastOrPresent, #Futureand #FutureOrPresent.
I'm using postman in order to call SuiteCRM REST API.
I tried to call this endpoint
PATCH http://{{suitecrm-url}}/Api/V8/module
and i've added this payload to the body (Content-Type: Application/Json):
{
"data": {
"type": "Accounts",
"id": "3a3ae651-d509-2508-7dc4-5be2e51cc96b",
"attributes": {
"name": "name with space"
}
}
}
When the request is executed SuiteCRM gives this response:
{
"errors": {
"status": 400,
"title": null,
"detail": "The option \"attributes\" with value array is invalid."
}
}
I found out that the problem was the whitespace in the value: when i tried to use the value "namewithspace", it worked.
Anyone has any idea how to solve this problem ?
Thanks in advance
I found out this issue on github that resolved my problem:
https://github.com/salesagility/SuiteCRM/issues/6452
In short to make it work i had to modify the file in
/Api/V8/Params/Options/Fields.php
and replace this line
const REGEX_FIELD_PATTERN = '/[^\w-,]/';
with
const REGEX_FIELD_PATTERN = '/[^\w-,\s\]/';
The person mentioned in github:
this is just for temporary fix and not upgrade safe
I'm trying to update my adset's targeting location to include 2 zip codes 85233 and 85224 but facebook keeps returning an Unknown error.
My request is
https://graph.facebook.com/v2.11/[ADSET_ID]
targeting={ "geo_locations":{"zips":[{"key":"US:85233"},{"key":"US:85224"}]}}
access_token=[ACCESS_TOKEN]
Response:
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1,
"fbtrace_id": "EA9s0p59E9h"
}
}
Please let me know the correct way to do this?
UPDATE: I have tried to update adset geolocation by lat and lng but the same error happened.
{
"geo_locations":{
"custom_locations":[
{
"radius":30,
"latitude":30.1519297,
"longitude":-97.8338758
}
]
}
}
Can you try to use "/v2.4/" and check whether it returns a proper response?
Because it seems like a FB API bug. Check this: https://developers.facebook.com/bugs/486654544831076/
I have setup a content type with a subject field that has pre assigned values in a dropdown field.
I am using the services api to post new content from a polymer app.
When I POST to the api I send the field structure and value in json but get and error.
"406 (Not Acceptable : An illegal choice has been detected. Please contact the site administrator.)"
Even though the object I am sending matches one of the required values in the field.
Do I need to prefix the value with something? I assume I'm posting to the right place to get that response but don't know why it would accept anything other than the string value.
Here is what I sent to the api which is picked up by my Charles proxy.
{
"node": {
"type": "case",
"title": "my case",
"language": "und",
"field_subject": {
"und": {
"0": {
"value": "subject1"
}
}
},
"body": {
"und": {
"0": {
"value": "my details of subject"
}
}
}
}
}
And here is an example of what I have setup in my Drupal field
subject1| first
subject2| second
subject3| third
subject4| forth
For anyone else with the same problem, this subject is poorly documented, but the answer is simple, my subject did not need the value key despite devel suggesting thats how it would be formatted.
"field_subject": {
"und": [
"subject1"
]
}
I could also shorten my code with "und" being an array.
I am using Github sample code for the Facebook Credits (callback.php and index.php) but its giving me the below error.. anybody have any solution???
"Order::update_order called with invalid state transition:3 -> 0"
Thanks..
Hard to answer without seeing the code you're using, but the response you send should look like this:
{
"method": "payments_status_update",
"content": {
"order_id": ORDER_ID,
"status": "settled"
}
}
ORDER_ID should be replaced by the order id sent from fB with the request.
There were incorrect examples out there that showed:
{
"method": "payments_status_update",
"content": [{
"order_id": ORDER_ID,
"status": "settled"
}]
}
but the second one doesn't work. Check to make sure you're not sending content as an array.