Announcement

Collapse
No announcement yet.

Rest api - put

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rest api - put

    Now that I have the GET part down (https://forum.espocrm.com/forum/deve...i-search-field) I have been testing with the PUT Function using this site: https://apitester.com/#



    POST http://localhost/api/v1/MDB/5c5751775e8d7d231

    Post Data:
    "name": "Testing12"

    I keep getting the following error and the API user key is correct since it works with the GET but unable to POST.

    Response Headers
    HTTP/1.1 404 Not Found
    Date: Wed, 06 Feb 2019 20:26:14 GMT
    Server: Apache/2.4.7 (Ubuntu)
    Content-Length: 311
    Content-Type: text/html; charset=iso-8859-1

    Any help?
    Last edited by khopper; 02-06-2019, 08:36 PM.

  • #2
    Hello

    it must be because you are trying to attack a local site (locahost) from https://apitester.com/! Your local site is not public accessbile

    Comment


    • khopper
      khopper commented
      Editing a comment
      I simply replaced my URL with localhost as to not make it public information.

  • #3
    You need to pass json data in payload. Also set content-type header to application/json.

    Comment


    • #4
      yuri
      Still getting the error 404 not found - see screen shot.
      Attached Files

      Comment


      • #5
        Try do so this action via EspoCRM UI and see what request is sent.

        POST is for creating. It's not supposed to pass ID in URL. For updating you need to use PUT.

        Comment


        • khopper
          khopper commented
          Editing a comment
          When doing a PUT Request the response comes back as "Method Not Allowed"
          PUT is not one of the allowed options below.

          HTTP/1.1 405 Method Not Allowed
          Date: Thu, 07 Feb 2019 14:30:10 GMT
          Server: Apache/2.4.7 (Ubuntu)
          Allow: GET,HEAD,POST,OPTIONS
          Content-Length: 334
          Content-Type: text/html; charset=iso-8859-1
      Working...
      X