Cannot POST to Mule console mock service

1.7k views Asked by At

I have enabled mule mock service via the API console. My get requests work fine, but not POST - gives 404; I'm testing through the 'try it' console, so the API def. exists:

Response
Request URL
http://mocksvc.mulesoft.com/mocks/87307809-5047-4f11-8376-f79b90612e8f/api/1.1/potentials/invoices
Status
404
Headers
connection: keep-alive
content-length: 84
content-type: text/html
date: Thu, 27 Nov 2014 09:57:26 GMT
server: nginx
vary: Accept-Encoding

Cannot POST /mocks/87307809-5047-4f11-8376-f79b90612e8f/api/1.1/potentials/invoices

Any known issues - or am i doing something wrong?

UPDATE - Now getting 500 Response:

The URL looks dodgy, like there's a proxy involved; but i have switched off the proxy in the Anypoint config.

Remote Address:107.23.223.75:443
Request URL:https://anypoint.mulesoft.com/apiplatform/proxy/http://mocksvc.mulesoft.com/mocks/4549e09f-5372-49a2-a025-1a779be1f8b0/api/1.0/potentials/invoices/by-group?calcs=sync
Request Method:POST
Status Code:500 Internal Server Error
Response Headers
view source
Connection:keep-alive
Date:Sun, 22 Mar 2015 09:13:16 GMT
Server:nginx
transfer-encoding:chunked
Request Headers
view source
Accept:*/*
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:4051
Content-Type:application/json
Cookie:optimizelyEndUserId=oeu1400511095000r0.22788078687153757; _biz_XDomainA=1; _biz_EventA=%5B1533429002%5D; km_ai=JG90g%2B1fhdCUqumO0lMOJkBuK0Q%3D; km_lv=x; __qca=P0-956406382-1408949189024; __cdrop=.4NE0R9.; ajs_anonymous_id=%228581a965-e03c-4f55-a16f-10463dc9137e%22; __utma=130558047.1044798684.1408703580.1416417421.1416579765.53; __utmz=130558047.1412919885.10.2.utmcsr=blogs.mulesoft.org|utmccn=(referral)|utmcmd=referral|utmcct=/release-anypoint-platform-api-2014-09/; __insp_slim=1417754555608; __insp_nv=true; __insp_ref=d; __insp_norec_sess=true; __utma=1.1044798684.1408703580.1424347974.1424358552.22; __utmz=1.1423198101.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); _ga=GA1.2.1044798684.1408703580; __unam=454cd6c-14ba063e172-7fff1062-3; optimizelySegments=%7B%22301426924%22%3A%22false%22%2C%22301577736%22%3A%22campaign%22%2C%22301577737%22%3A%22gc%22%7D; optimizelyBuckets=%7B%7D; __utma=259415958.1044798684.1408703580.1426582799.1426769497.26; __utmz=259415958.1426769497.26.8.utmcsr=newsletter|utmccn=march-mule-dev|utmcmd=email|utmcct=cta; trwv.uid=mulesoft-1423587308590-81ed229b%3A25%3A1; km_uq=; mulesoft.sess=eyJtZXRhIjp7ImNyZWF0ZWQiOjE0MjcwMTQ2MDcyNzAsInRvdWNoZWQiOjE0MjcwMTQ2MTEzOTgsImV4cGlyZXMiOjE0MjcwMjU0MTEzOTgsIm1heEFnZSI6MTA4MDAwMDB9LCJpZCI6InUtTGcwYlB2LS1uZnktV0hpMVpYNThWRWZaY2RrYzVHIiwicGFzc3BvcnQiOnsidXNlciI6eyJ1c2VyX2lkIjoiMmNlMWQ4YWQtNjUwNi00OGQ1LWEwODUtMDBhODhhYjVjNWQ2In19fQ==; mulesoft.sess.sig=AZq4JudQ9BmpLDxiaww_PH66nUs; token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6IjJjZTFkOGFkLTY1MDYtNDhkNS1hMDg1LTAwYTg4YWI1YzVkNiIsImZpcnN0TmFtZSI6IkdpbGJlcnQiLCJsYXN0TmFtZSI6IkdyYW50IiwiZW1haWwiOiJnaWxiZXJ0QGlyb24tbmVzdC5jb20iLCJ1c2VybmFtZSI6ImdpbGJlcnQtZ3JhbnQiLCJvcmdhbml6YXRpb24iOnsiaWQiOjEwMDYsIm5hbWUiOiJTeW50aGVzaXMgU29mdHdhcmUiLCJkb21haW4iOiJzeW50aGVzaXMtc29mdHdhcmUiLCJpZHByb3ZpZGVyX2lkIjoibXVsZXNvZnQiLCJjYW5NYW5hZ2UiOnRydWUsImV4dGVybmFsQXV0aG9yaXphdGlvbiI6ZmFsc2UsImlzRmVkZXJhdGVkIjpmYWxzZSwiY29yZVNlcnZpY2VzSWQiOiJhMjRjNDRjOS02ZjIzLTQ5MGUtYmIxNy1hZDllNzQ5Yzk5YTUifSwiaW50ZXJhY3RpdmVMb2dpbiI6dHJ1ZSwidG9rZW4iOiIzMDdiZWYwYS1lMjRjLTQwZmItYjRjNy00MTFkMWY5MGQ1ODUiLCJpYXQiOjE0MjcwMTQ2NDEsImF1ZCI6Imh0dHA6Ly9hcGktcGxhdGZvcm0vcmVwb3NpdG9yeSIsImlzcyI6Imh0dHA6Ly9hcGktcGxhdGZvcm0vcmVwb3NpdG9yeSJ9.KWasOy7fn_bV26GlX7VXX16JZUfnPUVts5s_jk_OKsU; ajs_user_id=null; ajs_group_id=null; _ga=GA1.1.1044798684.1408703580; _mkto_trk=id:564-SZS-136&token:_mch-mulesoft.com-1423198102013-16286; kvcd=1427014686069; km_vs=1; CLOUDHUB_SESSION=02454bf829ae4b0723359feecff307bef0a-e24c-40fb-b4c7-411d1f90d585
Host:anypoint.mulesoft.com
Origin:https://anypoint.mulesoft.com
Referer:https://anypoint.mulesoft.com/apiplatform/synthesis-software/
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36
X-Requested-With:XMLHttpRequest
Query String Parameters
view source
view URL encoded
calcs:sync

Even if i post directly to the mock URL from postman, i get an empty response error

2

There are 2 answers

0
mSolujic On

Found what was problem for me: invalid json example objects, a typo. Anypoint console is not smart enough to report that back.

Hope this helps somebody.

0
Mike Stowe On

A 404 would suggest that resource you are trying to post for doesn't exist, or possibly doesn't have the post declaration defined in the RAML (which technically should be error 405 but currently returns as 404).

If you're still having issues I would suggest checking out the RAML forums (raml.org) or sharing your RAML spec so that we can see what exactly is going on.

I'll also suggest that we implement 405 for missing methods to help clarify any ambiguous errors in the future.

Thanks!