Additional Listing Actions
We're going to take a look at what else you can do with a listing. We've already talked about adding a listing and adding milestones, but here we're going to talk about a few advanced actions.
Reopen Enquiries
This endpoint does exactly what is says on the tin, reopens enquiries. What this does behind the scenes is remove the "Enquries Closed" milestone and removes the completed_at timestamp against the "Enquiries Opened" milestone.
Heres an example request:
curl \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR-ACCESS-TOKEN>" \
-X GET https://developers.viewmychain.com/api/v1/listing/1/reopen-enquiries
And an example response:
{
"message": "success",
"success": true,
"data": [],
"errors": []
}
API Reference https://developers.viewmychain.com/api/v1/listing/{listing}/reopen-enquiries
Check whether a chain is complete
A simple but useful check, is the chain of a given listing complete?
curl \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR-ACCESS-TOKEN>" \
-X GET https://developers.viewmychain.com/api/v1/listing/1/is-complete
{
"message": "success",
"success": true,
"data": {
"result": true
},
"errors": []
}
If the chain is complete then the result value will tell you, in this case the chain is complete as the result value is true.
API reference https://developers.viewmychain.com/api/v1/listing/{listing}/is-complete
Lagging Listings
This endpoint allows you to get all listings from the chain of a given listing that are lagging behind the most advanced listing. For example, say you have a chain with 3 listings in it, all have SSTC but one listing has searches ordered, when you ask for the listings that are lagging, you will receive the two listings that only have the SSTC milestone, and not the listing that has the searches ordered milestone.
curl \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR-ACCESS-TOKEN>" \
-X GET https://developers.viewmychain.com/api/v1/listing/3/lagging
Response:
{
"data": [
{
"id": 1,
"type": "listing",
"attributes": {
"address_id": 12345678,
"branch_id": 1,
"price": 100000,
"chain_link_id": "DFAD3925-0322-49F4-8F14-BF516CE96097",
"is_locked": false,
"full_address": "1 Sample Street, Sample Town, AB12 3CD",
"address_street_name": "1 Sample Street",
"address_area": "Sample Town",
"address_postal_code": "AB12 3CD",
"created_at": 1511264955,
"updated_at": 1511264955
}
},
{
"id": 2,
"type": "listing",
"attributes": {
"address_id": 12345678,
"branch_id": 1,
"price": 100000,
"chain_link_id": "DFAD3925-0322-49F4-8F14-BF516CE96097",
"is_locked": false,
"full_address": "2 Sample Street, Sample Town, AB12 3CD",
"address_street_name": "2 Sample Street",
"address_area": "Sample Town",
"address_postal_code": "AB12 3CD",
"created_at": 1511264955,
"updated_at": 1511264955
}
}
],
"links": {
"self": "https://developers.viewmychain.com/api/v1/listing/3/lagging?page=1",
"last": "https://developers.viewmychain.com/api/v1/listing/3/lagging?page=1",
"first": "https://developers.viewmychain.com/api/v1/listing/3/lagging?page=1"
},
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 15,
"current_page": 1,
"total_pages": 1
}
}
}
API Reference https://developers.viewmychain.com/api/v1/listing/{listing}/lagging
Make a Listing available
Let's assume your listing has an SSTC milestone, however the buyer has backed out, a quick way to achieve this is to fall through your listing. Take the listing id and hit the end point like so:
curl \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR-ACCESS-TOKEN>" \
-X GET https://developers.viewmychain.com/api/v1/listing/3/fall-through
If successful the SSTC milestone will be removed from this listing and you will receive a standard success response:
{
"message": "success",
"success": true,
"data": [],
"errors": []
}
API Reference https://developers.viewmychain.com/api/v1/listing/{listing}/fall-through
Complete a Listing
The purpose of this endpoint is for you as an agent to remove the listing from your stock list. If you do complete the listing, it will automatically assume all the other listings in the chain are complete and remove those too. If you do not complete your listings manually, fear not, when we receive data telling us they are complete will remove them automatically, this is only if you want to force the issue. You don't have to specify a date, if you don't then we will assume the listing was completed today, otherwise you can set a completed_at parameter which is a date in the format of YYYY-MM-DD HH:MM:SS i.e. 2018-01-25 12:00:00
Here is an example of this request:
curl \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR-ACCESS-TOKEN>" \
-X PUT -d {"completed_at": "2018-01-25 12:00:00" } \
https://developers.viewmychain.com/api/v1/listing/3/complete
If successful, for all intents and purposes, the listing will no longer exist, if you try to get it, you will get a 404 response.
// success response
{
"message": "success",
"success": true,
"data": [],
"errors": []
}
API Reference https://developers.viewmychain.com/api/v1/listing/{listing}/complete
Attaching a Sales Negotiator
If you want to assign a sales negotiator to a listing, you will need three things, the users contact id, the listing id, and the role. Given you are attaching them as the sales negotiator the role is simply sales negotiator. If you don't have the listing yet following the steps above on finding a listing to help you, once you have then you need the listing id. Let's assume we're using the listing we created earlier. The only piece missing now is the users contact_id, we get this by getting the branch and including the users, we already have the branch id as we have the listing so the request will look like this:
curl \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR-ACCESS-TOKEN>" \
-X GET \
https://developers.viewmychain.com/api/v1/branch/99999?includes=users
The response should look like this:
{
"data":{
"type":"branch",
"id":"99999",
"attributes":{
"created_at":1485865700,
"updated_at":1485865700,
"deleted_at":null,
"brand_id":9999,
"name":"View My Chain Milton Keynes MK5 8FT",
"telephone":"01908 829400",
"email":"",
"website":""
},
"relationships":{
"users":{
"data":[{
"type":"user",
"id":"229"
},{
"type":"user",
"id":"463"
}]
}
}
},
"included":[{
"type":"user",
"id":"229",
"attributes":{
"created_at":1510830154,
"updated_at":1510830154,
"deleted_at":null,
"first_name":"John",
"last_name":"Smith",
"email":"john.smith@viewmychain.com",
"contact_id":227
}
},{
"type":"user",
"id":"463",
"attributes":{
"created_at":1505224612,
"updated_at":1505224651,
"deleted_at":null,
"first_name":"Jane",
"last_name":"Doe",
"email":"jane.doe@viewmychain.com",
"contact_id":471
}
}]
}
As you can see the View My Chain Milton Keynes branch has two users available as sales negotiators, once you have picked the one you would like i.e. Jane, you take the contact_id value (471).
Now we have our three attributes, we can make the request to attach Jane as the progressor for our listing:
curl \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR-ACCESS-TOKEN>" \
-X POST -d {"role": "sales negotiator" } \
https://developers.viewmychain.com/api/v1/contact/471/listing/1/attach
If successful you will get a simple success response:
{
"success":true,
"message":"success",
"errors":[]
}
Users are created by invitation by the View My Chain team, or by a Branch Manager from the Branch Management page on View My Chain.
To retrieve the Sales Negotiator use this endpoint: https://developers.viewmychain.com/api/v1/listing/{listing}/sales-negotiator