Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Vlad Bukhanets
/
immoscout24-api-php
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Merge Requests
0
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
bf7ec52f
authored
2020-08-10 09:36:58 +0200
by
fehrlich
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of gitlab.com:fehrlich/immoscout24-api-php
2 parents
68508bef
fa4d2ad6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
13 deletions
src/ImmoScoutAPI.php
src/ImmoScoutAPI.php
View file @
bf7ec52
...
...
@@ -182,7 +182,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
{
$domain
=
$this
->
getDomain
();
return
'https://rest.'
.
$domain
.
'/restapi/'
;
return
'https://rest.'
.
$domain
.
'/restapi/'
;
}
/**
...
...
@@ -237,7 +237,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
$stack
->
push
(
$oAuth
);
$client
=
new
Client
([
'base_uri'
=>
'https://rest.sandbox-immobilienscout24.de/restapi/'
,
'base_uri'
=>
$this
->
getBaseUrl
()
,
'handler'
=>
$stack
,
'auth'
=>
'oauth'
,
]);
...
...
@@ -266,7 +266,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
throw
new
InvalidResponse
(
'Could not parse the requested request token'
);
}
$this
->
saveRequestToken
(
$body
[
'oauth_token'
],
$body
[
'oauth_token_secret'
]);
header
(
'Location: '
.
$this
->
getBaseUrl
()
.
'security/oauth/confirm_access?oauth_token='
.
$body
[
'oauth_token'
]);
header
(
'Location: '
.
$this
->
getBaseUrl
()
.
'security/oauth/confirm_access?oauth_token='
.
$body
[
'oauth_token'
]);
exit
();
}
...
...
@@ -369,7 +369,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
}
$path
=
str_replace
(
'{user}'
,
$this
->
user
,
$path
);
return
$url
.
$path
;
return
$url
.
$path
;
}
/**
...
...
@@ -521,7 +521,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
$msgs
=
$this
->
parseMessages
(
$res
);
if
(
!
isset
(
$msgs
[
'parsed'
][
$expectedResponse
]))
{
$code
=
isset
(
$msgs
[
'parsed'
][
'ERROR_RESOURCE_NOT_FOUND'
])
?
404
:
null
;
throw
new
InvalidResponse
(
'Did not get expected response: '
.
$res
->
getBody
(),
$code
,
null
,
$res
,
$msgs
);
throw
new
InvalidResponse
(
'Did not get expected response: '
.
$res
->
getBody
(),
$code
,
null
,
$res
,
$msgs
);
}
if
(
$expectedResponse
==
'MESSAGE_RESOURCE_CREATED'
)
{
return
$msgs
[
'parsed'
][
$expectedResponse
][
0
];
...
...
@@ -588,7 +588,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
*/
public
function
updateRealEstate
(
$id
,
$obj
)
{
$res
=
$this
->
callUserMethod
(
'realestate/'
.
$id
.
'?usenewenergysourceenev2014values=true'
,
'PUT'
,
$obj
);
$res
=
$this
->
callUserMethod
(
'realestate/'
.
$id
.
'?usenewenergysourceenev2014values=true'
,
'PUT'
,
$obj
);
return
$this
->
checkForResponseUpdated
(
$res
);
}
...
...
@@ -603,7 +603,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
*/
public
function
deleteAttachment
(
$reId
,
$attachmentId
)
{
$res
=
$this
->
callUserMethod
(
'realestate/'
.
$reId
.
'/attachment/'
.
$attachmentId
,
'DELETE'
);
$res
=
$this
->
callUserMethod
(
'realestate/'
.
$reId
.
'/attachment/'
.
$attachmentId
,
'DELETE'
);
return
$this
->
checkForResponseDeleted
(
$res
);
}
...
...
@@ -628,7 +628,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
*/
public
function
createAttachment
(
$objId
,
$attachmentData
,
$content
,
$mimeType
=
'image/jpeg'
,
$fileName
=
'image.jpg'
)
{
$res
=
$this
->
callUserMethod
(
'realestate/'
.
$objId
.
'/attachment/'
,
'POST'
,
[
$res
=
$this
->
callUserMethod
(
'realestate/'
.
$objId
.
'/attachment/'
,
'POST'
,
[
'multipart'
=>
[
[
'Content-type'
=>
'application/json'
,
...
...
@@ -648,6 +648,21 @@ abstract class ImmoScoutAPI extends GuzzleClient
}
/**
* create simple attachment for an realestate, without a file attached.
*
* @param string $objId realestate id used by is24
* @param array $attachmentData compatible with https://api.immobilienscout24.de/our-apis/import-export/attachments/post.html
*
* @return string returns the id that is used by is24, this should be saved
*/
public
function
createSimpleAttachment
(
$objId
,
$attachmentData
)
{
$res
=
$this
->
callUserMethod
(
'realestate/'
.
$objId
.
'/attachment/'
,
'POST'
,
$attachmentData
);
return
$this
->
checkForResponseCreated
(
$res
);
}
/**
* update realestate attachment.
*
* @param string $objId realestate id used by is24
...
...
@@ -658,7 +673,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
*/
public
function
updateAttachment
(
$objId
,
$id
,
$attachmentData
)
{
$res
=
$this
->
callUserMethod
(
'realestate/'
.
$objId
.
'/attachment/'
.
$id
,
'PUT'
,
$attachmentData
);
$res
=
$this
->
callUserMethod
(
'realestate/'
.
$objId
.
'/attachment/'
.
$id
,
'PUT'
,
$attachmentData
);
return
$this
->
checkForResponseUpdated
(
$res
);
}
...
...
@@ -673,7 +688,7 @@ abstract class ImmoScoutAPI extends GuzzleClient
*/
public
function
updateAttachmentOrder
(
$objId
,
$orderArray
)
{
$res
=
$this
->
callUserMethod
(
'realestate/'
.
$objId
.
'/attachment/attachmentsorder'
,
'PUT'
,
[
$res
=
$this
->
callUserMethod
(
'realestate/'
.
$objId
.
'/attachment/attachmentsorder'
,
'PUT'
,
[
'attachmentsorder.attachmentsorder'
=>
[
'@xmlns'
=>
[
'attachmentsorder'
=>
'http://rest.immobilienscout24.de/schema/attachmentsorder/1.0'
,
...
...
@@ -704,17 +719,19 @@ abstract class ImmoScoutAPI extends GuzzleClient
/**
* Get an array of all contacts that can be specified for a real estate.
*
* @param string $reId realestate id used by is24 *
*/
public
function
delete
(
$reId
)
{
$res
=
$this
->
callUserMethod
(
'realestate/'
.
$reId
,
'DELETE'
);
$res
=
$this
->
callUserMethod
(
'realestate/'
.
$reId
,
'DELETE'
);
return
$this
->
checkForResponseDeleted
(
$res
);
}
/**
* Get an array of all contacts that can be specified for a real estate.
*
* @param string $reId realestate id used by is24
* @param string $publishchannel publish channel id like 10000
*/
...
...
@@ -735,13 +752,14 @@ abstract class ImmoScoutAPI extends GuzzleClient
}
/**
* unpublish a real estate
* unpublish a real estate.
*
* @param string $reId realestate id used by is24
* @param string $publishchannel publish channel id like 10000
*/
public
function
unpublish
(
$reId
,
$publishchannel
=
'10000'
)
{
$res
=
$this
->
callMethod
(
'publish/'
.
$reId
.
'_'
.
$publishchannel
,
'DELETE'
);
$res
=
$this
->
callMethod
(
'publish/'
.
$reId
.
'_'
.
$publishchannel
,
'DELETE'
);
return
$this
->
checkForResponseDeleted
(
$res
);
}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment