Discussions

    Search Discussion
    Most Recent Posts
    Questions regarding ThePort's API library. SOAP and REST API methods are supported here.  
    View All TopicsSubscribePost a Topic or Question
    42 Posts
    General Questions
    By TJ Muehleman   
    General questions asked here
    TJ Muehleman - VP Technology

    www.twitter.com/theportlabs 
    Block signature
    ReplyRemoveEditUnsubscribeSubscribe

    Visit PatrickHynes's profile
    12 Posts
    PatrickHynes  says:
    I have some questions about using the API to create social objects and joining users to created objects:

    1) The CreateSocialObject method does not appear to return the social object ID for the created object in the reponse XML. What is the recommended way of capturing the ID of a social object I have created with this method call? Would I have to create the object, then call GetSocialObjects and find my object in the response?

    2) In my application, I am referencing community users by their guid. I am assuming not the same as the ID required for UserJoinSocialObject. If this is the case, is there a way I can get the user ID from the guid, or is there a good way to obtain the user's ID through the API via email address or something like that?  Would the thing to do be use the GetUsers call and filter by email address?

    3) Tangentially related: The GetUser(s) methods, according to the documentation, return a value for the user's email address.  When I have been calling this method, though, the content of that node seems to be blank.  That is, I am getting <Email /> returned in the XML.  Is there a setting that needs to change to get this value populated, or is it not coming through for some other reason?

    Thanks for your help.
    Posted:   
    ReplyDirect LinkRemoveEdit

    Visit Dugan's profile
    61 Posts
    Dugan  says:
    Hi Patrick and welcome to the community,



    1. We reviewed this api on Friday and found that the ID of the newly created SocialObject was not being returned in the response xml; this has been corrected and the fix will be available after the next release. In the meantime, you can use the GetSocialObjects api to get the n most recently created SocialObjects and interrogate that.



    2. How are you getting a handle on this GUID? We currently provide two ways of fetching a User: By int and by encrypted guid (this is the User's TP_SSID cookie):



    http://services.theport.com/REST/V1/Users/{Int}?devkey=




    or



    http://services.theport.com/REST/V1/Users/{TP_SSID}?devkey=


    Can you get a handle on the TP_SSID cookie?

    3. We also looked into this issue on Friday; it looks as if some of the Users in the community contain an e-mail address and some do not. The example call that you provided via e-mail returns some Users with and some without. I suspect that this is an SSO issue; I will follow up with our SSO architect to see if we can get a handle on this.
    Posted:   
    Michael DuganSenior Platform Developer

    www.twitter.com/theportlabs
     
    "Time flies like an arrow.  Fruit flies like a banana"


    Block signature
    ReplyDirect LinkRemoveEdit

    Visit PatrickHynes's profile
    12 Posts
    PatrickHynes  says:
    Thanks for the quick response.

    For the questions:
    1) That works for me.

    2) I can grab the TP_SSID cookie value for users so that sounds like it will work.

    3) Any follow up here is appreciated.

    Thanks again.
    Posted:   
    ReplyDirect LinkRemoveEdit

    Visit Dugan's profile
    61 Posts
    Dugan  says:
    Follow-up to #3:
    The only required piece of information on SSO registration is the XRefCode, which is generally going to be the remote system's User ID. All other elements are optional; my suspicion is that some or all Users are coming over without the e-mail address. I just registered with www.arthritis.org with two different e-mails. A trace at the db level shows no e-mail address being recorded (First/Last name is); is it possible that the e-mail is not being submitted or not being submitted properly?
    Posted:   
    Michael DuganSenior Platform Developer

    www.twitter.com/theportlabs
     
    "Time flies like an arrow.  Fruit flies like a banana"


    Block signature
    ReplyDirect LinkRemoveEdit

    Visit Dugan's profile
    61 Posts
    Dugan  says:
    One additional item: In order to use the tp_ssid cookie to fetch a user, you will need to specify
    SearchBy=ssid

    in the querystring.
    Posted:   
    Michael DuganSenior Platform Developer

    www.twitter.com/theportlabs
     
    "Time flies like an arrow.  Fruit flies like a banana"


    Block signature
    ReplyDirect LinkRemoveEdit

    Visit PatrickHynes's profile
    12 Posts
    PatrickHynes  says:
    I'm having a bit of trouble with the GetUser call. I took the value of the tp_SSID cookie and formed the URL from that:
    https://services.theport.com/REST/V1/Users/334f5c57beac587668ad0919ebe6421322d11dc8218af54a360b9e67e131400412a5e094222af76dbfa93c9f4dc92b50f67be59c2ea26cdeb37a62e6c319ef89?devkey=...&SearchBy=ssid

    The response get is 404 user ID is invalid.

    I tried using the ID returned by a call to GetUsers (http://services.theport.com/REST/V1/Users?devkey=...) and got the same response.

    URL:
    https://services.theport.com/REST/V1/Users/960135?devkey=...

    Any idea on what I'm missing here?

    Thanks.
    Posted:   
    ReplyDirect LinkRemoveEdit

    Visit Dugan's profile
    61 Posts
    Dugan  says:
    We've diagnosed and resolved an issue with fetching a User. Please try again and let us know of any issues.
    Posted:   
    Michael DuganSenior Platform Developer

    www.twitter.com/theportlabs
     
    "Time flies like an arrow.  Fruit flies like a banana"


    Block signature
    ReplyDirect LinkRemoveEdit

    Visit Dugan's profile
    61 Posts
    Dugan  says:
    wrt the e-mail issue, I've looked into our api call that fetches a User from your system; it does not look like e-mail is an available field to fetch, which is why the e-mail is blank on our side. Note that our User api contains an XRefCode node; this is actually the identifier of the User in your system. Would using this to look up the user data on your side be sufficient?
    Posted:   
    Michael DuganSenior Platform Developer

    www.twitter.com/theportlabs
     
    "Time flies like an arrow.  Fruit flies like a banana"


    Block signature
    ReplyDirect LinkRemoveEdit

    Visit PatrickHynes's profile
    12 Posts
    PatrickHynes  says:
    Hi Guys,

    More API stuff. I am making a call to the CreateSocialObject method with the following:

    URL:
    https://services.theport.com/REST/V1/SocialObjects?sysuserid=168038&devkey=...

    Post Data:
    <Post><Action>1</Action><Parameters><SocialObject><Name>The Snakes</Name><SocialObjectTypeID>586</SocialObjectTypeID><Description></Description><CustomFields/><PredefinedLists/><FreeLists/></SocialObject></Parameters></Post>


    And getting the response:
    <Response xmlns="http://services.theport.com" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><StatusCode>500</StatusCode><StatusDescription>An Unknown Exception has Occurred on the Server.</StatusDescription></Response>


    Any ideas on what is going on here?

    Thanks,

    Patrick
    Posted:   
    ReplyDirect LinkRemoveEdit

    Visit Dugan's profile
    61 Posts
    Dugan  says:
    Hi Patrick,
    Reviewed our internal logs; looks like it's an issue with forums being enabled for this particular Social Object type. I will investigate further and let you know as soon as we resolve the issue.
    Posted:   
    Michael DuganSenior Platform Developer

    www.twitter.com/theportlabs
     
    "Time flies like an arrow.  Fruit flies like a banana"


    Block signature
    ReplyDirect LinkRemoveEdit

    Visit Dugan's profile
    61 Posts
    Dugan  says:
    We just did a push to the REST server to correct this issue. I was able to post a new Social Object to one of our testing communities without error. Please try again and let us know of any issues.
    Posted:   
    Michael DuganSenior Platform Developer

    www.twitter.com/theportlabs
     
    "Time flies like an arrow.  Fruit flies like a banana"


    Block signature
    ReplyDirect LinkRemoveEdit

    Visit PatrickHynes's profile
    12 Posts
    PatrickHynes  says:
    The CreateSocialObject now seems to be working. Now I'm having trouble with the GetSocialObjects call. I am using the following URL as an HTTP GET request:
    https://services.theport.com/REST/V1/SocialObjects?devkey=...

    And getting the following response:
    HTTP/1.1 405 Method Not Allowed
    Cache-Control: private
    Content-Type: text/html
    Server: Microsoft-IIS/7.0
    X-AspNet-Version: 2.0.50727
    X-Powered-By: ASP.NET
    Date: Thu, 14 Jan 2010 22:14:11 GMT
    Content-Length: 1177

    <html version="-//W3C//DTD XHTML 2.0//EN" xml:lang="en" xsi:schemaLocation="http://www.w3.org/1999/xhtml http://www.w3.org/MarkUp/SCHEMA/xhtml2.xsd" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><HEAD><TITLE>Request Error</TITLE></HEAD><BODY><DIV id="content"><P class="heading1"><B>Error Description:</B> 'HTTP Method not allowed'</P><P><B>This may be because an invalid URI or HTTP method was specified. Please see the <A HREF="http://web05.portprod.theport.com/REST/Service/SocialObjectService.svc/help">service help page</A> for constructing valid requests to the service.</B></P><!-- Padding xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx--></DIV></BODY></html>

    Again, thanks for the help.
    Posted:   
    ReplyDirect LinkRemoveEdit

    Visit Dugan's profile
    61 Posts
    Dugan  says:
    https://services.theport.com/REST/V1/SocialObjectTypes/586/SocialObjects?devkey=

    is what you want.
    Posted:   
    Michael DuganSenior Platform Developer

    www.twitter.com/theportlabs
     
    "Time flies like an arrow.  Fruit flies like a banana"


    Block signature
    ReplyDirect LinkRemoveEdit

    Visit PatrickHynes's profile
    12 Posts
    PatrickHynes  says:
    Another API issue

    When using the UserJoinSocialObject method, the StatusCode of the response is 500 (Unknown exception) but it does appear to be joining the user to the social object.

    URL:
    https://services.theport.com/REST/V1/SocialObjects?sysuserid=1541512&devkey=...
    Data:
    <Post><Action>3</Action><Parameters><UserID>1541512</UserID><SocialObjectID>566714</SocialObjectID></Parameters></Post>

    Response:
    <Response xmlns="http://services.theport.com" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><StatusCode>500</StatusCode><StatusDescription>An Unknown Exception has Occurred on the Server.</StatusDescription></Response>

    For now I've set my script to accept 500 as a success, but if you could take a look at this, that would be great.

    Thanks.
    Posted:   
    ReplyDirect LinkRemoveEdit

    Visit Dugan's profile
    61 Posts
    Dugan  says:
    Congratulations, Patrick, you're the first developer to hit Social Object apis when forums are involved. We just pushed the fix, you should now be getting back a 200.
    Posted:   
    Michael DuganSenior Platform Developer

    www.twitter.com/theportlabs
     
    "Time flies like an arrow.  Fruit flies like a banana"


    Block signature
    ReplyDirect LinkRemoveEdit

    Visit kcoleman's profile
    50 Posts
    kcoleman  says:
    This is a General Question I received today via email:

    I had a client who was trying to build a user search function utilizing our User API methods. He was getting the below error in his response.

    The reason why this error came about is because all of ThePort's REST searches require a StartPosition of '1' instead of '0'. Once the StartPosition was updated to '1' the correct response was returned.

    URL:
    https://services.theport.com/REST/V1/Users?devkey=...&SearchTerm=bob&SortB
    y=
    EnterDTM&SortDirection=Desc&numresults=45&startposition=0

    RESPONSE:
    <html version="-//W3C//DTD XHTML 2.0//EN" xml:lang="en"
    xsi:schemaLocation="http://www.w3.org/1999/xhtml
    http://www.w3.org/MarkUp/SCHEMA/xhtml2.xsd
    " xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
    ">






    'InternalServerError'


    The server encountered an error processing
    the
    request. Please see the server logs for more details.

    <!-- Padding
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-->



    Posted:   
    Program Manager at ThePort Network



    Block signature
    ReplyDirect LinkRemoveEdit

    Visit Dugan's profile
    61 Posts
    Dugan  says:
    We have updated the REST library so that if a 0 or negative value is plugged in, then a standard friendly xml/json error will return rather than the block of html noted above.
    Posted:   
    Michael DuganSenior Platform Developer

    www.twitter.com/theportlabs
     
    "Time flies like an arrow.  Fruit flies like a banana"


    Block signature
    ReplyDirect LinkRemoveEdit

    Visit gadgeteer's profile
    57 Posts
    gadgeteer  says:
    Sorry to have to ask again... Where's the most recent documentation for this?
    Posted:   
    ReplyDirect LinkRemoveEdit

    Visit ThePortAdmin's profile
    85 Posts
    ThePortAdmin  says:
    Hey gadgeteer, sorry for the delayed response. Here is the answer to your question. The documentation can be found here:
    http://developer.theport.com/Web_Services/REST_APIs
    Posted:   

    I'm around to assist.
    Block signature
    ReplyDirect LinkRemoveEdit