-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.php
150 lines (126 loc) · 3.54 KB
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
use meucarronovoAPI\MeuCarroNovo as MCN;
require('vendor/autoload.php');
//======================================================================
// Oauth
//======================================================================
$mcn = new MCN(
array(
'grant_type' => '{grant_type}',
'username' => '{username}',
'password' => '{password}',
'auth64' => '{auth64}'
)
);
$token = $mcn->getToken();
//======================================================================
// features
//======================================================================
$mcn = new MCN($token['token']);
/*GET Accessories*/
$data = $mcn->getAccessories();
/*Get Makes*/
$data = $mcn->getMakes();
/*GET numer doors*/
$data = $mcn->getDoors();
/*GET models by make*/
$params=[
'make_id'=> 4,
'make_name' => 'FIAT'
];
$data = $mcn->getModels($params);
/* GET version by make and model*/
$params =[
'make_id' => 4,
'model_name' => 'PALIO WAY'
];
$data = $mcn->getVersions($params);
/*GET make years*/
$params['version_id'] = 200003666;
$data = $mcn->getMakeYears($params);
/*GET colors*/
$data = $mcn->getColors();
/*GET fuel types used*/
$data = $mcn->getFuelTypes();
/*GET types exchange*/
$data = $mcn->getExchange();
//======================================================================
// Ads
//======================================================================
$mcn = new MCN(
array(
'grant_type' => '{grant_type}',
'username' => '{username}',
'password' => '{password}',
'auth64' => '{auth64}'
)
);
$token = $mcn->getLoginEnterprise();
$mcn = new MCN($token['token']);
/*Get list of ads*/
$data = $mcn->getAds();
/*Post new ad*/
$params = [
'version' => '200003666',
'make_year' => '2015',
'model_year' => '2015',
'plate' => 'ASD1234',
'renavam' => '18749726159',
'color' => '6',
'fuel' => '13'
'km' => '25000',
'exchange' => '1',
'door' => '2',
'price' => '27000',
'accept_exchange' => false,
'text' => 'Etiam et dignissim neque. Maecenas ut elit sit amet justo ultricies finibus quis vitae mi.',
'current_document' => true,
'armored' => false,
'pne' => false,
'car_used' => true,
'options' => ['1','2','3','6','30']
];
$data = $mcn->postDeal($params);
/*Update a ad*/
$params = [
'id' => '{ad_id}'
'version' => '200003666',
'make_year' => '2015',
'model_year' => '2015',
'plate' => 'ASD1234',
'renavam' => '18749726159',
'color' => '6',
'fuel' => '13'
'km' => '25000',
'exchange' => '1',
'door' => '2',
'price' => '27000',
'accept_exchange' => false,
'text' => 'Etiam et dignissim neque. Maecenas ut elit sit amet justo ultricies finibus quis vitae mi.',
'current_document' => true,
'armored' => false,
'pne' => false,
'car_used' => true,
'options' => ['1','2','3','6','30']
];
$data = $mcn->putDeal($params);
/*post a picture ad*/
$params = [
'ad_id' => '{ad_id}',
'url' => '{url}',
'order' => '{order}',
'cover' => '{cover}'
];
$data = $mcn->postPicture($params);
/*delete a ad*/
$params = ['ad_id' => '{ad_id}'];
$data = $mcn->deleteAd($params);
/*delete a ad*/
$params = ['ad_id' => '{ad_id}'];
$data = $mcn->deleteAllPicture($params);
/*delete one picture*/
$params = [
'ad_id' => '{ad_id}',
'picture_id' => '{picture_id}'
];
$data = $mcn->deletePicture($params);