News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
400 bad request on send MMS
Tags: rest api
Dec 19, 2019 at 3:30am   •   2 replies  •  0 likes
Roman Rozum

Hi,

I'm trying to send a mms-message using https://github.com/ringcentral-tutorials/sms-api-php-demo

I filled all the data in ".env". Here all correctly (I have goes send sms)

$ php send-sms.php
Message sent. Message delivery status: Queued

The message does reach (I check Glip chat)


But mms message cannot be sent. Get the error:

$ php send-mms.php
Expected HTTP Error: 400 Bad Request (and additional error happened during JSON parse: Response is not JSON)

And moreover, if we consider the response in more detail, it contains only the text of the error "Bad request" and nothing else.


I tried sending a very small file (~100 bytes). And it works!

Message sent. Message delivery status: Queued


I don't understand how it should work and how I should use it in my app. I think it's some kind of bug and it should not be. Tell me, what should I do with it?

2 Answers
answered on Dec 19, 2019 at 8:26am  

You said you send a very small file and it works, that means that the code is working as expected. I doubt that you try to send some big file or unsupported content. So check out the MMS capabilities below.

RingCentral supported MMS content types

  • Images: jpg/jpeg, png, gif, bmp, tif/tiff, svg
  • Videos: 3gp, mp4, mpeg, flv, wmv, mov
  • Audio: mp3
  • Files: vcf/vcard, zip, rtf, html

Attachment size limit

The maximum size for MMS is carrier-dependent and normally around 1.2MB to 1.4MB.

You can send multiple attachments in a single MMS message. But the total size of attachments should not exceed the size limit above!

Also, if you want to see more from the error, change or print whatever from the exception you want to see within this block:

}catch (\RingCentral\SDK\Http\ApiException $e) {
  print 'Expected HTTP Error: ' . $e->getMessage() . PHP_EOL;
}

 0
answered on Dec 19, 2019 at 8:58am  

@Phong Vu

I am sending a jpg which is attached in the project (test.jpg). It has a size of 16.1 KB.

I know about the ability to get additional information from the Exception. But the $e does not contain anything except "code" - 400 and "message" - Bad Request

$e->apiResponse()->response()

Prints this object:

object(GuzzleHttp\Psr7\Response)#45 (6) {
  ["reasonPhrase":"GuzzleHttp\Psr7\Response":private]=>
  string(11) "Bad Request"
  ["statusCode":"GuzzleHttp\Psr7\Response":private]=>
  int(400)
  ["headers":"GuzzleHttp\Psr7\Response":private]=>
  array(4) {
    ["Server"]=>
    array(1) {
      [0]=>
      string(5) "nginx"
    }
    ["Date"]=>
    array(1) {
      [0]=>
      string(29) "Thu, 19 Dec 2019 16:45:36 GMT"
    }
    ["Content-Length"]=>
    array(1) {
      [0]=>
      string(1) "0"
    }
    ["Connection"]=>
    array(1) {
      [0]=>
      string(5) "close"
    }
  }
  ["headerNames":"GuzzleHttp\Psr7\Response":private]=>
  array(4) {
    ["server"]=>
    string(6) "Server"
    ["date"]=>
    string(4) "Date"
    ["content-length"]=>
    string(14) "Content-Length"
    ["connection"]=>
    string(10) "Connection"
  }
  ["protocol":"GuzzleHttp\Psr7\Response":private]=>
  string(3) "1.1"
  ["stream":"GuzzleHttp\Psr7\Response":private]=>
  object(GuzzleHttp\Psr7\Stream)#43 (7) {
    ["stream":"GuzzleHttp\Psr7\Stream":private]=>
    resource(75) of type (stream)
    ["size":"GuzzleHttp\Psr7\Stream":private]=>
    NULL
    ["seekable":"GuzzleHttp\Psr7\Stream":private]=>
    bool(true)
    ["readable":"GuzzleHttp\Psr7\Stream":private]=>
    bool(true)
    ["writable":"GuzzleHttp\Psr7\Stream":private]=>
    bool(true)
    ["uri":"GuzzleHttp\Psr7\Stream":private]=>
    string(10) "php://temp"
    ["customMetadata":"GuzzleHttp\Psr7\Stream":private]=>
    array(0) {
    }
  }
}

 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us