Jump to content

Rest api example /api/cms/records/ POST


Go to solution Solved by InfinityRazz,

Recommended Posts

  • Solution
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 by InfinityRazz
Tested for sure ;)
Link to comment
Share on other sites

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"); 😉

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...