Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Suggested answer

400 bad request error

Posted on by 165

Hi All ,

i m sending  json  'POST' request and its acting very wierd .  I have Order and  15 OrderLineItem 1:N .

I have plugin which fires on update of Order field and covert the json and send to particular url , but problem is sometimes it send all  15 OrderLineItem on retriggering it twice or thrice and some times it send only 5 OrderLineItem .And when i tried to test the issue via console and postman then  return 400 ERROR BAD REQUEST when i tested on Postman tool . However , i can see all data has been serialized in plugin trace log . but only 5 OrderLineItem have been sent to vendor . and rest have been not delivered to vendor .

How can i find out where the problem is , is it at crm side or is it at server side where api is hosted and how can we fix this , and why only partial orderlineitems are getting sent .

  • nickmanny Profile Picture
    nickmanny 136 on at
    RE: 400 bad request error

    Error 400: Bad Request is a common HTTP status code that indicates that the server was unable to understand the request sent by the client. This can occur due to various reasons, such as invalid syntax, missing or incorrect parameters, or a request that is too large to be processed.

    When a client encounters this error code, it means that the request it sent to the server was not properly formatted or contained invalid data. This could be due to a mistake made by the client or an issue with the server's ability to parse the request. To resolve this error: 400 Bad Request, the client should check their request to ensure that it is properly formatted and includes all necessary information. Additionally, the server should be checked to ensure that it is able to handle the request and parse the data properly.

  • Shahzeb Khan Profile Picture
    Shahzeb Khan 165 on at
    RE: 400 bad request error

    Please mark my answer so it could help other people .

  • meelamri Profile Picture
    meelamri 13,198 User Group Leader on at
    RE: 400 bad request error

    you can display a friendly message to your CRM end users in case this error occurs.

  • Suggested answer
    Shahzeb Khan Profile Picture
    Shahzeb Khan 165 on at
    RE: 400 bad request error

    This was due to validation at vendor side with network fluctuation .

  • Shahzeb Khan Profile Picture
    Shahzeb Khan 165 on at
    RE: 400 bad request error

    Please see and let me know, asap , let me also tell you, at run time my partial json is sent not, how can i restrict it from sending partial json . when i debugg my plugin i shows my entire json, but when i run it at runtime my partial json is sent and sometimes give me time out error and even then partial json is sent.

    Kindly suggest .

  • Shahzeb Khan Profile Picture
    Shahzeb Khan 165 on at
    RE: 400 bad request error

    3225.Header.PNG

    json

    {"RequestDeliveryBy":"","asc_accountid":"255060","asc_billtoaddressid":"3627581","asc_billtocountryid":"Switzerland","asc_billtostateid":"","asc_ecommerceorderidtxt":"1026014","asc_email":"registration@ascensia.ch","asc_netsuiteorderidtxt":"","asc_ordertype":"Ecommerce","asc_ponumbertxt":"","asc_salesrepid":"","asc_samplereasontxt":"","asc_shippinginstructions":"","asc_shiptoaddressid":"3627581","asc_shiptocountryid":"Switzerland","asc_shiptostateid":"","billto_city":"Basel","billto_contactname":"Birgitt Bechler","billto_line1":"Peter Merian-Strasse 90","billto_line2":"","billto_line3":"","billto_name":"ADC CH eComm-Test","billto_postalcode":"4052","billto_telephone":"","description":"","pricelevelid":"Base Price","salesorderdetails":[{"asc_eshopdiscount":"","asc_shiptoaddressid":"","asc_warehousecode":"","asc_warehouseid":"","description":"","ispriceoverridden":"True","priceperunit":"24.9000","productid":"13403","quantity":"8.0000000000","salesorderdetailid":"aa288598-3244-ea11-a812-000d3ab15843","transactioncurrencyid":"CHF","uomid":"EA"},{"asc_eshopdiscount":"","asc_shiptoaddressid":"","asc_warehousecode":"","asc_warehouseid":"","description":"","ispriceoverridden":"True","priceperunit":"9.8000","productid":"13402","quantity":"12.0000000000","salesorderdetailid":"b7288598-3244-ea11-a812-000d3ab15843","transactioncurrencyid":"CHF","uomid":"EA"},{"asc_eshopdiscount":"","asc_shiptoaddressid":"","asc_warehousecode":"","asc_warehouseid":"","description":"","ispriceoverridden":"True","priceperunit":"48.5300","productid":"13404","quantity":"48.0000000000","salesorderdetailid":"bd288598-3244-ea11-a812-000d3ab15843","transactioncurrencyid":"CHF","uomid":"EA"},{"asc_eshopdiscount":"7.0500000000","asc_shiptoaddressid":"","asc_warehousecode":"","asc_warehouseid":"","description":"","ispriceoverridden":"True","priceperunit":"-164.2255","productid":"13404","quantity":"1.0000000000","salesorderdetailid":"cf288598-3244-ea11-a812-000d3ab15843","transactioncurrencyid":"CHF","uomid":"EA"},{"asc_eshopdiscount":"","asc_shiptoaddressid":"","asc_warehousecode":"","asc_warehouseid":"","description":"","ispriceoverridden":"True","priceperunit":"48.5300","productid":"13570","quantity":"24.0000000000","salesorderdetailid":"e1288598-3244-ea11-a812-000d3ab15843","transactioncurrencyid":"CHF","uomid":"EA"},{"asc_eshopdiscount":"7.0500000000","asc_shiptoaddressid":"","asc_warehousecode":"","asc_warehouseid":"","description":"","ispriceoverridden":"True","priceperunit":"-82.1128","productid":"13570","quantity":"1.0000000000","salesorderdetailid":"ef288598-3244-ea11-a812-000d3ab15843","transactioncurrencyid":"CHF","uomid":"EA"},{"asc_eshopdiscount":"","asc_shiptoaddressid":"","asc_warehousecode":"","asc_warehouseid":"","description":"","ispriceoverridden":"True","priceperunit":"24.9000","productid":"13517","quantity":"6.0000000000","salesorderdetailid":"f9288598-3244-ea11-a812-000d3ab15843","transactioncurrencyid":"CHF","uomid":"EA"},{"asc_eshopdiscount":"","asc_shiptoaddressid":"","asc_warehousecode":"","asc_warehouseid":"","description":"","ispriceoverridden":"True","priceperunit":"33.3500","productid":"13396","quantity":"3.0000000000","salesorderdetailid":"02298598-3244-ea11-a812-000d3ab15843","transactioncurrencyid":"CHF","uomid":"EA"},{"asc_eshopdiscount":"","asc_shiptoaddressid":"","asc_warehousecode":"","asc_warehouseid":"","description":"","ispriceoverridden":"True","priceperunit":"33.3500","productid":"13533","quantity":"1.0000000000","salesorderdetailid":"09298598-3244-ea11-a812-000d3ab15843","transactioncurrencyid":"CHF","uomid":"EA"},{"asc_eshopdiscount":"","asc_shiptoaddressid":"","asc_warehousecode":"","asc_warehouseid":"","description":"","ispriceoverridden":"True","priceperunit":"9.2500","productid":"10371","quantity":"12.0000000000","salesorderdetailid":"0d298598-3244-ea11-a812-000d3ab15843","transactioncurrencyid":"CHF","uomid":"EA"},{"asc_eshopdiscount":"","asc_shiptoaddressid":"","asc_warehousecode":"","asc_warehouseid":"","description":"","ispriceoverridden":"True","priceperunit":"9.2500","productid":"10373","quantity":"6.0000000000","salesorderdetailid":"12298598-3244-ea11-a812-000d3ab15843","transactioncurrencyid":"CHF","uomid":"EA"},{"asc_eshopdiscount":"","asc_shiptoaddressid":"","asc_warehousecode":"","asc_warehouseid":"","description":"","ispriceoverridden":"True","priceperunit":"9.2500","productid":"10372","quantity":"12.0000000000","salesorderdetailid":"1d298598-3244-ea11-a812-000d3ab15843","transactioncurrencyid":"CHF","uomid":"EA"},{"asc_eshopdiscount":"","asc_shiptoaddressid":"","asc_warehousecode":"","asc_warehouseid":"","description":"","ispriceoverridden":"True","priceperunit":"16.3000","productid":"11744","quantity":"1.0000000000","salesorderdetailid":"27298598-3244-ea11-a812-000d3ab15843","transactioncurrencyid":"CHF","uomid":"EA"},{"asc_eshopdiscount":"","asc_shiptoaddressid":"","asc_warehousecode":"","asc_warehouseid":"","description":"","ispriceoverridden":"True","priceperunit":"19.5000","productid":"11728","quantity":"12.0000000000","salesorderdetailid":"30298598-3244-ea11-a812-000d3ab15843","transactioncurrencyid":"CHF","uomid":"EA"},{"asc_eshopdiscount":"5.5800000000","asc_shiptoaddressid":"","asc_warehousecode":"","asc_warehouseid":"","description":"","ispriceoverridden":"True","priceperunit":"-13.0572","productid":"11728","quantity":"1.0000000000","salesorderdetailid":"36298598-3244-ea11-a812-000d3ab15843","transactioncurrencyid":"CHF","uomid":"EA"},{"asc_eshopdiscount":"","asc_shiptoaddressid":"","asc_warehousecode":"","asc_warehouseid":"","description":"","ispriceoverridden":"True","priceperunit":"9.2500","productid":"8864","quantity":"6.0000000000","salesorderdetailid":"cfca7f9e-3244-ea11-a812-000d3ab15843","transactioncurrencyid":"CHF","uomid":"EA"},{"asc_eshopdiscount":"","asc_shiptoaddressid":"","asc_warehousecode":"","asc_warehouseid":"","description":"","ispriceoverridden":"True","priceperunit":"9.8500","productid":"11686","quantity":"6.0000000000","salesorderdetailid":"e8ca7f9e-3244-ea11-a812-000d3ab15843","transactioncurrencyid":"CHF","uomid":"EA"},{"asc_eshopdiscount":"","asc_shiptoaddressid":"","asc_warehousecode":"","asc_warehouseid":"","description":"","ispriceoverridden":"True","priceperunit":"9.2500","productid":"8863","quantity":"6.0000000000","salesorderdetailid":"f5ca7f9e-3244-ea11-a812-000d3ab15843","transactioncurrencyid":"CHF","uomid":"EA"}],"salesorderid":"c7380997-3244-ea11-a812-000d3ab39933","shipto_city":"Basel","shipto_contactname":"Birgitt Bechler","shipto_line1":"Peter Merian-Strasse 90","shipto_line2":"","shipto_line3":"","shipto_name":"ADC CH eComm-Test","shipto_postalcode":"4052","shipto_telephone":"","statecode":"0","statuscode":"860000000","submitdate":"1/31/2020","transactioncurrencyid":"CHF"}"

  • meelamri Profile Picture
    meelamri 13,198 User Group Leader on at
    RE: 400 bad request error

    can u screenshot you request wihtin postman, i want to say the header and JSON ?  blur your confidential data.

  • Shahzeb Khan Profile Picture
    Shahzeb Khan 165 on at
    RE: 400 bad request error

    in postman, its 200 ok, using plugin only they are getting partial data, however in plugin trace log, we see entire data sent .

  • Suggested answer
    meelamri Profile Picture
    meelamri 13,198 User Group Leader on at
    RE: 400 bad request error

    Please modify the request until success using Postman Client ! Then test in ConsolApp.

  • Shahzeb Khan Profile Picture
    Shahzeb Khan 165 on at
    RE: 400 bad request error

    Yes, it sends data, on response i get bad request 400 via console .

    Plugin trace shows all json captured however vendor says only few ordelines json recieved not all .

    i dont know, why its acting this way .

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,572 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,764 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans