Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted September 12, 20204 yr Since the REST API does not accept a json body, what does the URL have to look like to transfer "fields"? Can someone please give an example? Something like: https://www.domain.com/api/cms/records/4?key=mykey&category=7&author=1&fields="field_8":"content here..." Isn't working... Edited September 16, 20204 yr by sebastianr
September 16, 20204 yr Author Anyone have an idea? The support does not want to help here, it would be above the standard... 🥴
September 18, 20204 yr Solution Anyone have an idea? The support does not want to help here, it would be above the standard... 🥴 i mean.. in c# using RestSharp it's something along the lines of => var Client = new RestClient("WebsiteUrl"); var Request = new RestRequest("/api/cms/records/{dID}/{rID}" + "/?key=Api Key With perms", DataFormat.Json); Request.AddUrlSegment("dID", 6); Request.AddUrlSegment("rID", 1); Request.AddParameter("fields[24]", "This changes record title"); var Response = Client.Post(Request); if (Response.StatusCode == HttpStatusCode.OK) { // Convert Response.Content and/or Response.Data to class object } else Console.WriteLine(Response.StatusCode); Edited September 18, 20204 yr by InfinityRazz Tested for sure ;)
September 19, 20204 yr Author Perfect. I didn't know Request.AddParameter("fields[24]", "This changes record title"); is how an array is passed via RESTSharp. Thank you!
September 19, 20204 yr Perfect. I didn't know Request.AddParameter("fields[24]", "This changes record title"); is how an array is passed via RESTSharp. Thank you! Yeah! It's definitely a lil weird cause it returns field_##, took me a couple weeks to get used to making RestRequests here 😛 CustomFields on a purchase/member request are similar as well : Request.AddParameter("customField[#]", "StringValue"); 😉
September 23, 20204 yr Author Yeah! It's definitely a lil weird cause it returns field_##, took me a couple weeks to get used to making RestRequests here 😛 CustomFields on a purchase/member request are similar as well : Request.AddParameter("customField[#]", "StringValue"); 😉 Yeah, same thing. Took me also weeks until to ask for support here. If the REST API would accept a json body, it would be easier.