No configured device_types could be resolved from request

HI,

ios push notification not working and show some error like this showing.

 

Message:Bad Request
HttpResponse:HTTP/1.1 400 Bad Request [Content-Type: application/vnd.urbanairship+json;version=3, Content-Length: 152, Date: Sat, 06 Aug 2016 10:26:03 GMT, Connection: close]
Error:APIError:Could not parse request body.
Code:Optional.of(40000)
Details:
APIErrorDetails:
Path:null
Error:No configured device_types could be resolved from request.

My code is just like this

APIClient apiClient = APIClient.newBuilder().setKey(appKey).setSecret(appSecret).build();
IOSDevicePayload iospayload = IOSDevicePayload.newBuilder()
.setAlert(headtext)
.addExtraEntry("notification_url", url)
.build();
Notification notification2 = Notifications.notification(iospayload);



PushPayload payload = PushPayload.newBuilder()
.setAudience(Selectors.deviceToken(token))
.setNotification(notification2)
.setDeviceTypes(DeviceTypeData.of(DeviceType.IOS))
.build();

try {
System.out.println(payload.toJSON());

APIClientResponse<APIPushResponse> response = apiClient.push(payload);


} catch (APIRequestException ex) {
System.out.println(ex.toString());
}

 

 

Payload print like this.

 

{"audience":{"device_token":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"},"device_types":["ios"],"notification":{"ios":{"alert":"xxxxxxxxxxxxxxxxxxxxxxxxxxx","extra":{"notification_url":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}}}}

 

 

 

 

 

 

 

 

 

Didn't find what you were looking for?

New post

Comments

3 comments

  • Hi Ramasamy,

    The error "No configured device_types could be resolved from request" typically means that the application you are trying to send a push from, does not currently have any push notification service configured. 

    So, you'll need to upload your iOS certificate before you can send a push to that app.

    Comment actions Permalink
    0
  • Hi Michael Halka,

    The same payload successfully working in Test Push Notifications of the urbanairship console. 

    But it is throwing this error while using java API,

    The same code was successful in android applications. 

     

     

    Comment actions Permalink
    0
  • Hi Ramasamy,

    Which App Key are you testing with?

    Comment actions Permalink
    0

Please sign in to leave a comment.