cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

PATCH Request with apoc.load.jsonParams

bieri
Node Link

Hi Everyone

I was wondering if it is possible to execute a POST request to an API using apoc.load.jsonParams?
It wold come in handy to update a lot of tuples in another database.

I tried the following without success:

CALL apoc.load.jsonParams($URL+"/api/v1/customers/557",
{accept:"application/json; charset=UTF-8",`Content-Type`:"application/json; charset=UTF-8",
`Body-Content-Type`:"application/json",Authorization:$Auth},
'{"description": "test2"}',
'',
{METHOD:"PATCH"}) 

The error I am getting is: 405 - Method Not Allowed. Therefore I assume apoc still sends the request as a GET instead of PATCH.

Here's the request I am trying to send as curl;

curl -X PATCH "https://time.lobsi.com/actitime/api/v1/customers/557" 
-H "accept: application/json; charset=UTF-8" 
-H "authorization: Basic YWRtaW46MjFDZW50dXJ5" 
-H "Content-Type: application/json; charset=UTF-8" 
-d "{ \"description\": \"test\"}"

Kind Regards from Switzerland
Simon

1 ACCEPTED SOLUTION

Yes please you have to put the method into the headers, like here:

call apoc.load.jsonParams("https://neo4j.com/docs/search/", 
{method:"POST"},apoc.convert.toJson({query:"pagecache",version:"3.5"}))

View solution in original post

1 REPLY 1

Yes please you have to put the method into the headers, like here:

call apoc.load.jsonParams("https://neo4j.com/docs/search/", 
{method:"POST"},apoc.convert.toJson({query:"pagecache",version:"3.5"}))