Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-05-2019 06:49 AM
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
Solved! Go to Solution.
08-14-2019 12:05 PM
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"}))
08-14-2019 12:05 PM
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"}))
All the sessions of the conference are now available online