Hi Team,

I am trying to save a user entered[page developed in AngularJS] information
as a json document in Mark Logic through ML REST API but am facing below
issue :

*browser console:*
"NetworkError: 401 Unauthorized -
http://localhost:8003/v1/documents?uri=/docs/";
documen...=/docs/
2
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the
remote resource at http://localhost:8003/v1/documents?uri=/docs/. This can
be fixed by moving the resource to the same domain or enabling CORS.


*In browser NetWork Tab it shows as below :*

<error-response xmlns="http://marklogic.com/xdmp/error";>
  <status-code>404</status-code>
  <status>Not Found</status>
  <message-code>RESTAPI-NODOCUMENT</message-code>
  <message>RESTAPI-NODOCUMENT: (err:FOER0000) Resource or document does not
exist:  category: content message: /docs/userInfo.json
</message>
</error-response>

*code tried to connect :*
$http({
    method: 'PUT',
    url: 'http://localhost:8003/v1/documents?uri=/docs/userInfo.json',
    data: data1,
headers:{
                'Access-Control-Allow-Origin': '*',
                'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE,
OPTIONS',
                'Access-Control-Allow-Headers': 'Content-Type,
X-Requested-With'
            }
}).success(function () {alert('Successfully Added In DB');});
}
});

My Angular JS web page is deployed in tomcat on port 7080 and my REST API
is located at 8003.Also i have not passed any credentials to connect ML and
am not not sure on how to pass authentication .

Could you please guide me in getting this resolved.


Thanks,
Sateesh
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to