Important Update: Community URLs redirect issues are partially resolved. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

ContentAPI - Update Records

Michael
Contributor

I am attempting to utilize the Content API (C#) to update / insert records within Archer.  I am able to successfully connect and read either all, contentapi/Procedures_ODA, or individual, contentapi/Procedures_ODA(TrackingID).  However, the update attempt returns Error 400 - Bad Request. 

 

Within my code, I read the record, deserialize it, then for testing I serialize it and attempt to update the same record without any data changes.

 

1. What URL should be utilized for the update - contentapi/Procedures_ODA or contentapi/Procedures_ODA(TrackingID)?

2. Should this be a HTTP Post request?

 

Update procedure -

        public Procedure UpdateProcedure(string sessionToken, Procedure proc, out string response)
        {
            string appURL = Global.BaseURL() + "contentapi/Procedures_ODA";

 

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(appURL);
            request.Accept = "application/json,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
            request.ContentType = "application/json";
            request.Method = "POST";
            request.Headers.Add(HttpRequestHeader.Authorization, "Archer session-id=" + sessionToken);

 

            using (StreamWriter dataStream = new StreamWriter(request.GetRequestStream()))
            {
                StringBuilder json = new StringBuilder();

                jss.Serialize(proc, json);

 

                dataStream.Write(json.ToString());

                dataStream.Flush();
            }

 

            var httpResponse = (HttpWebResponse)request.GetResponse();  <-- This returns Error 400 - Bad Request
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                response = streamReader.ReadToEnd();
            }
            if (!string.IsNullOrWhiteSpace(response))
            {
                var objToken = jss.Deserialize<Procedure>(response);
                return objToken;
            }
            return null;
        }

4 REPLIES 4

Anonymous
Not applicable

The process for https://community.rsa.com/docs/DOC-102165 within the Content API is documented at that link with examples.

Scott Hagemeyer‌,

 

Getting unauthorized access error message when i tried accessing the above link. Is it restricted?

Anonymous
Not applicable

Arun Prasad,

 

Are you logged in? That page requires access to the RSA Archer Customer/Partner Community" data-type="space‌, which is private. Details on how to make sure you are registered are on this page: How to register for an RSA Link account.

Scott Hagemeyer‌,

 

Yes, I am logged in and have access to the RSA Archer Customer/Partner Community. Not sure why I am getting an unauthorized access error.

 

Having said that, I can access the following: Content Save (different URL though).