How to tag data submission in kobo

Hi everyone.

Am experiencing difficulties tagging data.

I was able to tag the form using the approach shown below:

var client = new RestClient(“https://kc.kobotoolbox.org/api/v1/forms/{pk}/labels”);

client.Authenticator = new HttpBasicAuthenticator(userName, password);

client.AddDefaultUrlSegment(“pk”, formId);

var request = new RestRequest(Method.POST);

string tags = tagId;

request.AddParameter(“tags”, tags);

IRestResponse response1 = client.Execute(request);

But when I try tagging data for this form using the approach shown below I get 502 Bad Gateway.

var client = new RestClient(“https://kc.kobotoolbox.org/api/v1/data/{pk}/{dataid}/labels”);

client.Authenticator = new HttpBasicAuthenticator(userName, password);

client.AddDefaultUrlSegment(“pk”, formId);

client.AddDefaultUrlSegment(“dataid”, dataId);

var request = new RestRequest(Method.POST);

request.AddParameter(“tags”,myTag);

IRestResponse response = client.Execute(request);

And on the same note, how do I get the pk and dataid for the submitted data?

···

On Thursday, February 25, 2016 at 10:46:13 AM UTC+3, Joseph Luketelo wrote:

Hi everyone.

Am experiencing difficulties tagging data.

I was able to tag the form using the approach shown below:

var client = new RestClient(“https://kc.kobotoolbox.org/api/v1/forms/{pk}/labels”);

client.Authenticator = new HttpBasicAuthenticator(userName, password);

client.AddDefaultUrlSegment(“pk”, formId);

var request = new RestRequest(Method.POST);

string tags = tagId;

request.AddParameter(“tags”, tags);

IRestResponse response1 = client.Execute(request);

But when I try tagging data for this form using the approach shown below I get 502 Bad Gateway.

var client = new RestClient(“https://kc.kobotoolbox.org/api/v1/data/{pk}/{dataid}/labels”);

client.Authenticator = new HttpBasicAuthenticator(userName, password);

client.AddDefaultUrlSegment(“pk”, formId);

client.AddDefaultUrlSegment(“dataid”, dataId);

var request = new RestRequest(Method.POST);

request.AddParameter(“tags”,myTag);

IRestResponse response = client.Execute(request);