NotesHTTPRequest to update a profile using the Connections Administration API

I followed the documentation (here) to put a request to the Connections Administration API from a Lotusscript agent. Here a summary of the script :

url = "https://connections.mycompany.com/profiles/admin/atom/profileEntry.do?key=1620049a-3d2c-44a2-b378-6f7a6a87a414"
Set webRequest = session.CreateHTTPRequest()
webrequest.preferstrings = True 'if not error contenttype unsupported
Call webRequest.SetHeaderField("Authorization", "Basic " + encodeBase64) 'username:password encoded base64
Call webRequest.SetHeaderField("Content-Type","application/atom+xml")
call webRequest.put(url,body)
MsgBox webRequest.Responsecode 'HTTP/1.1 Bad Request

body is a string that contains the information profile to update :

body = |<?xml version="1.0" encoding="UTF-8"?>|
body = body + |<entry xmlns:app="http://www.w3.org/2007/app" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:fh="http://purl.org/syndication/history/1.0" xmlns:snx="http://www.ibm.com/xmlns/prod/sn" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.w3.org/2005/Atom">|
body = body + |<id>tag:profiles.ibm.com,2006:entry1620049a-3d2c-44a2-b378-6f7a6a87a414</id><category term="profile" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>|
body = body + |<content type="application/xml"><person xmlns="http://ns.opensocial.org/2008/opensocial"><com.ibm.snx_profiles.attrib>|
body = body + |<entry><key>com.ibm.snx_profiles.base.jobResp</key><value><type>text</type><data>Information to update</data></value></entry>|
body = body + |</com.ibm.snx_profiles.attrib></person></content></entry>|

but it doesn't work and the request response code is "HTTP/1.1 Bad request"

I used postman with exactly the same informations, that's run, the profile is updated

I have no problem with user right or authentification API because if i use the following script to retrieve profile informations, thats run :

url = https://connections.mycompany.com/profiles/admin/atom/profileEntry.do?email=myname@mycompany.com
Set webRequest = session.CreateHTTPRequest()
webrequest.preferstrings = True	
Call webRequest.SetHeaderField("Authorization", "Basic " + encodeBase64)
response = webRequest.get(url)
msgbox response 'user profile informations

Does anyone have any idea or experience with this type of query ?

Thanks for your help !

I guess you have to look into the Connections log, because Bad Request is just a general error message and could say anything, starting with missing access rights, typo in ids or structure, or much other things.

SO best look into connections log what exact error is mentioned there

As i writted, it's not a read / write rights issue.

I am a poor little developer who unfortunately does not have access to the logs

And as I said only the connection logs can say what exact the problem is.

So without access to them you can only try around

One addition which may could help:

You can chcek the return text/content when the Bad Request happens, maybe there is additional information in it

The origin of the problem was the base64 encoding of the "username: password" in the basic authorization header with Lotusscript.

But i didn't research this side first because the API requests to retrieve the profiles (get) work correctly with the same basic authorization, only the update (put) requests are problematic, strange !

So, i use a different way to encode authorization and everythings works perfect now !!!