If doOutput=false - call setDoOutput(true)

I have tried to execute the following on the current Neo4j Community Edition server:

CALL apoc.load.jsonParams ("https://api.box.com/2.0/search?query=A&type=folder&fields=id&limit=200&offset=200",{method:"GET",Authorization:"Bearer {actual token here}"},null)

The response was:

Failed to invoke procedure apoc.load.jsonParams: Caused by: java.net.ProtocolException: cannot write to a URLConnection if doOutput=false - call setDoOutput(true)

I have searched in vain for a solution. Can you help on this?

What happens when you call the URL in postman?

It generated a JSON response from Box just as expected

I was able to get it to work by removing the "method" header

CALL apoc.load.jsonParams ("https://api.box.com/2.0/search?query=A&type=folder&fields=id&limit=200&offset=200", {Authorization: "Bearer XXXXXXXX"},null) yield value
return value

I redacted my token before the screenshots:

Thanks so much! Then one more issue perhaps. I went back to Postman after well over 24 hours and the token seemed to stil work without being refreshed. However that same token does not seem to work in the neo4j call. Is there some kind of persistence in the Postman call? The error I get after following your spacing is now "Failed to invoke procedure apoc.load.jsonParams: Caused by: org.neo4j.graphdb.security.URLAccessValidationError: Unable to verify access to api.box.com. Cause: api.box.com."

Thanks so much! After correcting to match your content and spacing my error message is now "Failed to invoke procedure apoc.load.jsonParams: Caused by: org.neo4j.graphdb.security.URLAccessValidationError: Unable to verify access to [box api URL]. [box api URL]" I copied a token that is currently still working in Postman but still get this resuilt. (I substituted within the brackets because of an error on this site.)

Sorry...I am not seeing that behavior. The token is working in both platforms.

BTW- Adding method GET does work, but the key is case sensitive. It should be "Method", not "method". It does not have to be added because GET is used by default.

CALL apoc.load.jsonParams ("https://api.box.com/2.0/search?query=A&type=folder&fields=id&limit=200&offset=200", {Method: "GET", Authorization: "Bearer XXXXXXXX"},null) yield value
return value

Thanks, I will continue to explore the token issue. But if I import the Box JSON from a file I get "set apoc.import.file.enabled=true." But on the community edition I do not find an apoc.conf file and if I add that line to neo4j.conf it does not seem to make a difference. I also created apoc.conf and added that line but no change.

Create the apoc.conf file in the same location as the neo4j.conf file

I did that and added the line "apoc.import.file.enabled=true" to the apoc.conf file I created and restarted the server. No change.

Are you getting an error?

Yes, the same error - set apoc.import.file.enabled=true.

Thanks! I got past everything except the token and will continue to work on that.

1 Like