sebastianr Posted September 12, 2020 Posted September 12, 2020 (edited) 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, 2020 by sebastianr sobrenome 1
sebastianr Posted September 16, 2020 Author Posted September 16, 2020 Anyone have an idea? The support does not want to help here, it would be above the standard... 🥴
Solution InfinityRazz Posted September 18, 2020 Solution Posted September 18, 2020 (edited) On 9/16/2020 at 6:40 AM, sebastianr said: 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, 2020 by InfinityRazz Tested for sure ;) sebastianr 1
Daniel F Posted September 18, 2020 Posted September 18, 2020 Here's some example code which should work  sobrenome and sebastianr 2
sebastianr Posted September 19, 2020 Author Posted September 19, 2020 Perfect. I didn't know Request.AddParameter("fields[24]", "This changes record title"); is how an array is passed via RESTSharp. Thank you!
InfinityRazz Posted September 19, 2020 Posted September 19, 2020 4 hours ago, sebastianr said: 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"); 😉 sobrenome 1
sebastianr Posted September 23, 2020 Author Posted September 23, 2020 On 9/19/2020 at 6:46 PM, InfinityRazz said: 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.
Recommended Posts