[GeoNetwork-users] error 403 running post or put in (postman or python)

Hello all

i use geonetwork:4.2.5 elasticsearch:7.17.10

I am trying to import a xml metadata file. I tried with python code
and postman and it showed me a 403 status. The python code is:

import requests
url = f'http://localhost:8080/geonetwork/srv/api/records/
headers = {
        'accept': 'application/json',
        'Content-Type': 'application/xml',
        'X-XSRF-TOKEN': '6bb0011c-e1bc-438e-9442-9b6b91fc9fc2'}

data = """<?xml version="1.0" encoding="UTF-8"?>
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd&quot;
                 xmlns:gco="http://www.isotc211.org/2005/gco&quot;
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
                 xsi:schemaLocation="http://www.isotc211.org/2005/gmd
http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd&quot;&gt;
                 .......</gmd:MD_Metadata>
"""

response = requests.post(url, headers=headers, data=data)

if response.status_code == 201:
  print('Record created successfully.')
else:
  print('Error creating record: {}'.format(response.status_code))

and postman is: attach file

(attachments)

example.postman_collection.json (4.6 KB)