HTTP API

1. HTTP API Feature

HTTP API feature is a new way to send the updated data from Agentpoint system to other website domain which have registered before from the developer system.

There are several conditions which make this feature work:

  1. Domain for HTTP API must be defined. This is the url where the API will be sent.
  2. The checkbox for enabled HTTP API must be checked. System will check this value, if this value true then it allows to send API.
  3. The properties belonging to the office must not in Draft status. When users create or update a property and save it as Draft then there is no way to send the API to the 3rd party.
  4. Office status must remain active.
  5. HTTP API feature is also applied on team member and office information. This means when a user creates or updates a team member or office information the API will send this information to the 3rd party.

2. Parameters Input

All parameters are sent as json outputs

  1. Property API

On this API there are several parameters sent by using curl

    1. Property attributes
    2. Property detail attributes
    3. Primary and Secondary Contact attributes
    4. Images
    5. Brochures
    6. Floorplans

All string type parameters are encoded using Base64 encoding and the curl :

  1. curl -i -X POST -d 'property=#{encoded_property.to_json}&details=#{encoded_property_detail.to_json}&rental_seasons=#{rental_seasons.to_json}&contacts=#{users.to_json}&brochures=#{encoded_brochures.to_json}&opentimes=#{opentimes.to_json}&images=#{encoded_images.to_json}&floorplans=#{encoded_floorplans.to_json}&features=#{features.to_json}&callback_url=http://#{GLOBAL_ATTR["Host-#{self.office_id}"]}/agents/#{self.agent_id}/offices/#{self.office_id}/properties/#{self.id}/property_notification?token=#{token}&type=property' #{domain.ipn}
  1. Office API

For this API, all office attribute parameters will be sent to 3rd party by using this curl :

  1. curl -i -X POST -d 'office=#{encoded_office.to_json}&detail=#{self.domains.to_json}&callback_url=http://#{GLOBAL_ATTR["OFF-#{self.agent.id}-#{self.agent.developer.id}"]}/developers/#{self.agent.developer.id}/agents/#{self.agent.id}/offices/#{self.id}/office_notification?token=#{token}&type=office' #{domain.ipn}
  1. Team Member API

This API also sends all agent user attributes data by using this curl :

  1. curl -i -X POST -d 'contacts=#{encoded_team_member.to_json}&callback_url=http://#{GLOBAL_ATTR["Host-#{self.office_id}"]}/agents/#{self.agent.id}/offices/#{self.office_id}/agent_users/#{self.id}/team_notification?token=#{token}&type=team_member' #{domain.ipn}

Output

There are domain logs which can show if the parameters are sent. Here is the example of  results :

  1. Original Parameters
  1. contacts
  2. {"salt": "NmQxNjc4ZWZmZWNkODUxYjZkN2Y1ZDdjYTFiZTEwMjk4NjE0MzYxYQ==\n",
  3. "activated_at": null,
  4. "active_help_status": true,
  5. "api_is_sent": true,
  6. "linkedin_username": null,
  7. "office_id": 67,
  8. "updated_at": "2010-10-21T22:12:47 11:00",
  9. "testimonials": {},
  10. "code": "MDQ2\n",
  11. "crypted_password": "MGZiNzM4Y2Q1MWM1NmY2MmQ1Nzc3NjkxNGYzMGNhMDVkNGM0YjQ2OA==\n",
  12. "twitter_username": null,
  13. "deleted_at": "2010-10-21T22:12:47 11:00",
  14. "processed": null,
  15. "activation_code": "ZjA1NjQyNWFhODliNzViYjdlNDUyYTEyODZmNWYyNmEyYzdiM2QxNA==\n",
  16. "facebook_username": null,
  17. "remember_token_expires_at": null,
  18. "role": "",
  19. "type": "QWdlbnRVc2Vy\n",
  20. "video_url": null,
  21. "id": 5415,
  22. "suburb": null,
  23. "vcard": "",
  24. "landscape_images": {"1": "", "2": ""},
  25. "count_api_sent": 0,
  26. "description": "",
  27. "mobile": "",
  28. "fax": null,
  29. "phone": "ODgzIDc4NDI=\n",
  30. "remember_token": null,
  31. "reset_code": null,
  32. "first_name": "VGlt\n",
  33. "im_service": null,
  34. "developer_id": 1,
  35. "group": "U2FsZXMgQWdlbnQ=\n",
  36. "last_name": "SG93YXJk\n",
  37. "login": "aG93YXJk\n",
  38. "position": null,
  39. "portrait_images": {"1": "", "2": ""},
  40. "created_at": "2010-10-20T22:08:09 00:00",
  41. "email": "dGltQHRlc3QuY29t\n",
  42. "im_username": null,
  43. "video_code": null}
  44. ==================================================================================
  45. callback_url
  46. http://agentpoint.agentaccount.com/agents/3/offices/67/agent_users/5415/team_notification?token=215de1be37d338382a438b017ec5c19b
  47. ==================================================================================
  48. type
  49. team_member
  50. ==================================================================================
  51. status
  52. delete
  1. Json Parameters
  1. contacts
  2. salt : NmQxNjc4ZWZmZWNkODUxYjZkN2Y1ZDdjYTFiZTEwMjk4NjE0MzYxYQ==
  3. activated_at :
  4. active_help_status : 1
  5. api_is_sent : 1
  6. linkedin_username :
  7. office_id : 67
  8. updated_at : 2010-10-21T22:12:47 11:00
  9. testimonials
  10. code : MDQ2
  11. crypted_password : MGZiNzM4Y2Q1MWM1NmY2MmQ1Nzc3NjkxNGYzMGNhMDVkNGM0YjQ2OA==
  12. twitter_username :
  13. deleted_at : 2010-10-21T22:12:47 11:00
  14. processed :
  15. activation_code : ZjA1NjQyNWFhODliNzViYjdlNDUyYTEyODZmNWYyNmEyYzdiM2QxNA==
  16. facebook_username :
  17. remember_token_expires_at :
  18. role :
  19. type : QWdlbnRVc2Vy
  20. video_url :
  21. id : 5415
  22. suburb :
  23. vcard :
  24. landscape_images
    1 :
    2 :
  25. count_api_sent : 0
  26. description :
  27. mobile :
  28. fax :
  29. phone : ODgzIDc4NDI=
  30. remember_token :
  31. reset_code :
  32. first_name : VGlt
  33. im_service :
  34. developer_id : 1
  35. group : U2FsZXMgQWdlbnQ=
  36. last_name : SG93YXJk
  37. login : aG93YXJk
  38. position :
  39. portrait_images
    1 :
    2 :
  40. created_at : 2010-10-20T22:08:09 00:00
  41. email : dGltQHRlc3QuY29t
  42. im_username :
  43. video_code :
  44. ==================================================================================
  45. callback_url :
  46. ==================================================================================
  47. type :
  48. ==================================================================================
  49. status :

From the details above we can see the string parameters are encoded.