Re: Use REST API URL to update field
Ok. Thanks for your advice. Regards, Edwin On 21 July 2015 at 15:37, Upayavira wrote: > curl is just a command line HTTP client. You can use HTTP POST to send > the JSON that you are mentioning below via any means that works for you > - the file does not need to exist on disk - it just needs to be added to > the body of the POST request. > > I'd say review how to do HTTP POST requests from your chosen programming > language and you should see how to do this. > > Upayavira > > On Tue, Jul 21, 2015, at 04:12 AM, Zheng Lin Edwin Yeo wrote: > > Hi Shawn, > > > > So it means that if my following is in a text file called update.txt, > > > > {"id":"testing_0001", > > > > "popularity":{"inc":1} > > > > This text file must still exist if I use the URL? Or can this information > > in the text file be put directly onto the URL? > > > > Regards, > > Edwin > > > > > > On 20 July 2015 at 22:04, Shawn Heisey wrote: > > > > > On 7/20/2015 2:06 AM, Zheng Lin Edwin Yeo wrote: > > > > I'm using Solr 5.2.1, and I would like to check, is there a way to > update > > > > certain field by using REST API URL directly instead of using curl? > > > > > > > > For example, I would like to increase the "popularity" field in my > index > > > > each time a user click on the record. > > > > > > > > Currently, it can work with the curl command by having this in my > text > > > file > > > > to be read by curl (the "id" is hard-coded here for example purpose) > > > > > > > > {"id":"testing_0001", > > > > > > > > "popularity":{"inc":1} > > > > > > > > > > > > Is there a REST API URL that I can call to achieve the same purpose? > > > > > > The URL that you would use with curl *IS* the URL that you would use > for > > > a REST-like call. > > > > > > Thanks, > > > Shawn > > > > > > >
Re: Use REST API URL to update field
curl is just a command line HTTP client. You can use HTTP POST to send the JSON that you are mentioning below via any means that works for you - the file does not need to exist on disk - it just needs to be added to the body of the POST request. I'd say review how to do HTTP POST requests from your chosen programming language and you should see how to do this. Upayavira On Tue, Jul 21, 2015, at 04:12 AM, Zheng Lin Edwin Yeo wrote: > Hi Shawn, > > So it means that if my following is in a text file called update.txt, > > {"id":"testing_0001", > > "popularity":{"inc":1} > > This text file must still exist if I use the URL? Or can this information > in the text file be put directly onto the URL? > > Regards, > Edwin > > > On 20 July 2015 at 22:04, Shawn Heisey wrote: > > > On 7/20/2015 2:06 AM, Zheng Lin Edwin Yeo wrote: > > > I'm using Solr 5.2.1, and I would like to check, is there a way to update > > > certain field by using REST API URL directly instead of using curl? > > > > > > For example, I would like to increase the "popularity" field in my index > > > each time a user click on the record. > > > > > > Currently, it can work with the curl command by having this in my text > > file > > > to be read by curl (the "id" is hard-coded here for example purpose) > > > > > > {"id":"testing_0001", > > > > > > "popularity":{"inc":1} > > > > > > > > > Is there a REST API URL that I can call to achieve the same purpose? > > > > The URL that you would use with curl *IS* the URL that you would use for > > a REST-like call. > > > > Thanks, > > Shawn > > > >
Re: Use REST API URL to update field
Hi Shawn, So it means that if my following is in a text file called update.txt, {"id":"testing_0001", "popularity":{"inc":1} This text file must still exist if I use the URL? Or can this information in the text file be put directly onto the URL? Regards, Edwin On 20 July 2015 at 22:04, Shawn Heisey wrote: > On 7/20/2015 2:06 AM, Zheng Lin Edwin Yeo wrote: > > I'm using Solr 5.2.1, and I would like to check, is there a way to update > > certain field by using REST API URL directly instead of using curl? > > > > For example, I would like to increase the "popularity" field in my index > > each time a user click on the record. > > > > Currently, it can work with the curl command by having this in my text > file > > to be read by curl (the "id" is hard-coded here for example purpose) > > > > {"id":"testing_0001", > > > > "popularity":{"inc":1} > > > > > > Is there a REST API URL that I can call to achieve the same purpose? > > The URL that you would use with curl *IS* the URL that you would use for > a REST-like call. > > Thanks, > Shawn > >
Re: Use REST API URL to update field
On 7/20/2015 2:06 AM, Zheng Lin Edwin Yeo wrote: > I'm using Solr 5.2.1, and I would like to check, is there a way to update > certain field by using REST API URL directly instead of using curl? > > For example, I would like to increase the "popularity" field in my index > each time a user click on the record. > > Currently, it can work with the curl command by having this in my text file > to be read by curl (the "id" is hard-coded here for example purpose) > > {"id":"testing_0001", > > "popularity":{"inc":1} > > > Is there a REST API URL that I can call to achieve the same purpose? The URL that you would use with curl *IS* the URL that you would use for a REST-like call. Thanks, Shawn
Use REST API URL to update field
Hi, I'm using Solr 5.2.1, and I would like to check, is there a way to update certain field by using REST API URL directly instead of using curl? For example, I would like to increase the "popularity" field in my index each time a user click on the record. Currently, it can work with the curl command by having this in my text file to be read by curl (the "id" is hard-coded here for example purpose) {"id":"testing_0001", "popularity":{"inc":1} Is there a REST API URL that I can call to achieve the same purpose? Regards, Edwin