question

manu avatar image
manu asked Brian Murray Deactivated commented

java.io.FileNotFoundException when creating a modifier

https://api.clover.com/v3/merchantID/4B8BF3H7P/orders/Z00EM5WSSYEFP/line_items/1B1WP6BWXYN2T/modifiers?access_token=xyz

I am trying to add modifier to an Item, but getting file not found exception.

I altered the merchant Id and access token.

I am using the order and Line item Id which I got back as response when I created them.

java.io.FileNotFoundException: https://api.clover.com/v3/merchantID/4B8BF5NJH7P/orders/NHVB7654X2X1Y/line_items/JTEVX8FDT0P9G/modifiers?access_token=xyz
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1836)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at _jsp._sites._zsites.__0maninder_0test._pos._clover._clover__jsp._jspService(Unknown Source)
at com.caucho.jsp.JavaPage.service(JavaPage.java:61)
at com.caucho.jsp.Page.pageservice(Page.java:578)
at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:195)
at com.caucho.server.security.SecurityFilterChain.doFilter(SecurityFilterChain.java:134)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:192)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:187)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:265)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:273)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:682)
at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:743)
at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:662)
at java.lang.Thread.run(Thread.java:745)

I am using it on my computer. Everything else is working like Creating order, adding line items, payments , etc . Its only "modifiers" which giving this error

3 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·

Files shouldn't be involved. Is your code running on your computer or on a clover device or emulator? Send the complete stack trace and a code snippet please.

0 Likes 0 ·
manu avatar image manu commented ·

I updated the question and yes I am using my computer and working on JAVA

0 Likes 0 ·
Brian Murray avatar image Brian Murray commented ·

Please do not publicly post access tokens. I've removed the token from your post and deleted it from our server.

0 Likes 0 ·
Jacob Abrams avatar image
Jacob Abrams answered manu commented

See stackoverflow:

http://stackoverflow.com/questions/5379247/filenotfoundexception-while-getting-the-inputstream-object-from-httpurlconnectio
5 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

manu avatar image manu commented ·

Their answer did not work for me. I am very confused that I was able to make POST calls to add modifiers successfully. All of a sudden I start getting this error.

0 Likes 0 ·
Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·

Can you print the HTTP response code and use getErrorStream() to get the error response as suggested by stack overflow and post it here.

0 Likes 0 ·
manu avatar image manu commented ·

Response code using getResponseCode() = 404

getErrorStream() = 404 Not Found

Let me know if you need anything else to understand this better so I can fix it

0 Likes 0 ·
Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·

Your merchant id is clearly not correct 4B8BF3H7P, it is only 9 characters long, Clover ids are always 13 characters.

0 Likes 0 ·
manu avatar image manu commented ·

i altered the merchant ID when i post it here, otherwise I am using the correct Merchant ID.

0 Likes 0 ·
josh avatar image
josh answered manu commented

Your url is wrong. It should be v3/merchants/... (Also as Jacob pointed out you are using an incorrect merchant id.) Also please do not post your access tokens on a public forum. I'm going to delete this access token. Please generate a new one and do not share it publicly.

1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

manu avatar image manu commented ·

URL was wrong. Thanks Josh

0 Likes 0 ·

Welcome to the
Clover Developer Community