Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

SelfURL

my api call is this:
http://localhost/api/funeral/16326P

what is returned as self is:
"self": {
"href": "http://localhost/api/funeral"

in http_resource_services - SelfURL = http://localhost/api/funeral

I want it to be:
"self": {
"href": "http://localhost/api/funeral/16326P"

it used to be there before I did the upgrade mods, so I must have made a mistake somewhere and I dont know where to look.
Can you help me at all.

Comments

  • btw, the developer is saying it used to be there, not me because I can't remember seeing it.
  • Your developer is correct. The self URL should have an end point that reflects the unique ID of your resource. What you are getting is the same end point of the collection URL. The best I can do is to direct you to where the self URL is generated: HTTP_SERVICE_SETUP. There is a call to the GetFullEndPointURL service in the HTTP_Services module, so perhaps your problem is rooted in there.
  • i have debug'ed what the http_service_setup is doing.
    Appears to me - It is the http_service_setup code that is creating the selfurl with this (wrong)data.

    // The Full End Point URL indicates the URL submitted by the client.
    FullEndPointURL = HTTP_Services('GetFullEndPointURL')

    // The HTTP method (or verb) submitted by the client.
    HTTPMethod = HTTP_Services('GetHTTPRequestMethod')

    // The Self URL represents the Full End Point URL up to the current segment. This often used to in hypermedia responses
    // so clients know how to trace back.
    LenRemainingURL = Len(RemainingURL)
    LenFullEndPointURL = Len(FullEndPointURL)

    where fullendpointurl=http://localhost/api/funeral/16326P

    SelfURL = FullEndPointURL[1, (LenFullEndPointURL - LenRemainingURL)]
    If SelfURL[-1, 1] = '/' then SelfURL[-1, 1] = ''
    HTTP_Services('SetSelfURL', SelfURL)

    where selfURL is now http://localhost/api/funeral/
  • Seems to me that RemainingURL has data in it and this is why assignment to SelfURL is getting truncated.
  • edited February 2017
    So I have missed somewhere insert code changes.
    Any idea where the clearing of RemainingURL should be occuring
  • Not really. At this point I would need to debug your code to figure this out.
  • Ok
    Now I am getting this response and I really dont know what I have done to cause it.
    Any ideas?

    {
    "URL": "http://localhost/api/funeral/16326P",
    "method": "GET",
    "phrase": "Unauthorized (RFC 7235)",
    "status": 401
    }
  • the problem was that in http_services
    i missed changing this line from oecgi4 to oecgi3 (oecgi3 is actually a renamed oecgi4, but the docs still refer to 3 so I was confused enough as it was :) )

    OECGIRegKey = 'HKLM\SOFTWARE\Wow6432Node\Revsoft\OECGI4' ; // 64-bit server with OECGI4.exe
  • I did a , what I thought was a kludge, but I see in http_contacts_services.
    this is what I had in my _service routines(from rev version).

    HAL = HTTP_Resource_Services('GetDatabaseItem', 'STOCK', SelfURL, ItemID,ColumnNames)

    I changed to this:

    //bjs//
    ItemURL = SelfURL : '/' : ItemID
    HAL = HTTP_Resource_Services('GetDatabaseItem', 'STOCK', ItemURL, ItemID,ColumnNames)
    *HAL = HTTP_Resource_Services('GetDatabaseItem', 'STOCK', SelfURL, ItemID,ColumnNames)

    Your http_contact_services now has this
    HAL = HTTP_Resource_Services('GetDatabaseItem', 'CONTACTS', SelfURL : '/' : ItemID, ItemID)

    I obviously missed the advise to change to this calling assembly.
  • edited February 2017
    i missed changing this line from oecgi4 to oecgi3 (oecgi3 is actually a renamed oecgi4, but the docs still refer to 3 so I was confused enough as it was :) )

    Now you have me confused. Where in the docs does it still refer to 3?
  • I obviously missed the advise to change to this calling assembly.

    When was the last time you upgraded your system? The format was introduced in v2.0.0, which is almost a year old. I didn't think to consider that your end point web service may have had older formatting because I just assumed you had been upgrading in stages.

    But, for what it is worth, we did not spell out every code change between v1 and v2. Every routine that had been changed was listed in the version history page and we did post an article specifically to address some of the major differences between v1. and v2, but we could not reasonably explain every possible impact (nor did we intend to). We do endeavor to note which entities have been modified and we do try to note the major changes within the comment block of each routine. Beyond that, we leave it to the developer to decide if the new features are worth the effort to retrofit the new code into the older web app. I wish there was a better solution but one has not presented itself.
  • >>Now you have me confused. Where in the docs does it still refer to 3?
    Sorry, the RTI oecgi setup docs.
Sign In or Register to comment.