0

I created a test public corpus called /WOZIMA and I cannot fetch any JSON from it unless I use the credentials I used when creating it. When I create a new service and use those credentials, it doesn't return anything. I believe this is a permission issue on the corpus, so I'm now trying to update the permissions using the CURL command

curl -u user:pass -X POST -d '{"access":"private","users":[{"permission":"ReadWriteAdmin","account_id":"nessroingrec6"},], "public_fields":["last_modified","parts","user_fields"]}' "https://gateway.watsonplatform.net/concept-insights/api/v2/corpora/nessroingrec6/WOZIAMA" -o permissionChange.txt

Unfortunately I get an error:

{"error":"invalid corpus format","url":"/api/v2/corpora/nessroingrec6/WOZIAMA"}

How do I update the permissions for the corpus so the public can view it?

Andrew
  • 1,858
  • 13
  • 15
exitthebox
  • 11
  • 2

1 Answers1

1

My curl command was incorrect. The correct command is:

curl -i -u user:pass -X POST -d '{"access":"public","users":[ {"permission":"ReadWriteAdmin","account_id":"nessroingrec6"},{"permission":"ReadWrite","account_id":"public"}], "public_fields":["last_modified","parts","user_fields"]}' "https://gateway.watsonplatform.net/concept-insights/api/v2/corpora/nessroingrec6/WOZIAMA" -o permissionChange.txt'

I needed to make the first "access" public and add a section for the "account_id":"public".

This changed the permissions for the corpus to be public even though I originally set it up to be public using the javascript below:

conceptInsights.corpora.createCorpus({user: user,corpus: corpusName,access: 'public'}, function(err) {       if (err)
    return console.log('Error creating the corpus:', err);loadCorpus();});

There are probably some other permissions I should have set here, I just didn't do it.

exitthebox
  • 11
  • 2