# تحديث اسم الكيان المعتمد

## يسمح لك هذا النقطة بتحديث اسم الكيان المعتمد المحدد بمعرفه العالمي.

<mark style="color:orange;">`PUT`</mark> `https://api.iafcertsearch.org/api/client/v1/cb/ce-name-by-guid`

الحقول التي تحمل علامة النجمة (\*) إلزامية.

#### Headers

| Name                                                   | Type   | Description                                                                                                                                            |
| ------------------------------------------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>         | String | application/json                                                                                                                                       |
| x-http-authorization<mark style="color:red;">\*</mark> | String | <p>مفتاح API المستلم من <https://iafcertsearch.org/import-management/api-integration></p><p>مثال: <code>x-http-authorization: <<مفتاح API>></code></p> |

#### Request Body

| Name                                            | Type   | Description |
| ----------------------------------------------- | ------ | ----------- |
| company\_guid<mark style="color:red;">\*</mark> | String |             |
| company\_name<mark style="color:red;">\*</mark> | String |             |

{% tabs %}
{% tab title="200: OK الطلب ناجح." %}

```json
{
    "data": {
        "company_id": "string",
        "company_name": "string",
        "company_trading_name": "string",
        "company_street": "string",
        "company_city": "string",
        "company_suburb": "string",
        "company_postcode": "string",
        "company_state": "string",
        "company_country": "string",
        "company_email": "string",
        "company_status": "string",
        "company_type": "string",
        "company_contact": string,
        "company_logo": "[]",
        "company_banner": "[]",
        "countries_id": number,
        "company_website": "string",
        "company_tz": number,
        "company_tz_text": "string",
        "company_hash": "string",
        "company_guid": "string",
        "company_phone": string,
        "company_business_type": string,
        "company_address": string,
        "company_en_name": "string",
        "qualitytrade_id": number,
        "qualitytrade_hash": string,
        "company_search_limit": number,
        "is_confidential": number,
        "activated_at": date,
        "created_at": date,
        "updated_at": date
    }
}
```

{% endtab %}

{% tab title="400: Bad Request أخطاء أخرى موضحة في استجابة الواجهة البرمجية." %}

```json
{
    "error": true,
    "timestamp": number (وقت الحقبة),
    "elapse": number,
    "errors": {
      "message": "error_message",
      "code": "error_code"
    }
}
```

{% endtab %}

{% tab title="401: Unauthorized يحدث عند استخدام مفتاح API غير صالح." %}

```json
{
    "error": true,
    "timestamp": number (وقت الحقبة),
    "elapse": number,
    "errors": {
      "message": "Invalid Session token has been used.",
      "code": "invalid_session_token"
    }
}
```

{% endtab %}

{% tab title="422: Unprocessable Entity لم يتم التحقق." %}

```json
{
    "error": true,
    "timestamp": number (وقت الحقبة),
    "elapse": number,
    "errors": {
        "code": "validation_error",
        "message": {
            "field_name": "error_message"
        }
    }
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
لعرض مثال على بيانات الاستجابة، انقر فوق السهم الأيمن في الجانب الأيمن من وصف الاستجابة.
{% endhint %}

{% hint style="info" %}
يمكنك أيضًا استخدام <https://api.sandbox.iafcertsearch.org/api/client/v1/cb/ce-name-by-guid> لاختباره على خادم الرمل.
{% endhint %}

شاهد كيف يمكنك استدعاء هذه الطريقة:

{% tabs %}
{% tab title="cURL" %}

```shell
curl --location --request PUT 'https://api.iafcertsearch.org/api/client/v1/cb/ce-name-by-guid' \
--header 'x-http-authorization: <<API_KEY>>' \
--header 'Content-Type: application/json' \
--header 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36' \
--data-raw '{
    "company_guid" : "string",
    "company_name" : "string"
}'
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require "uri"
require "json"
require "net/http"

url = URI("https://api.iafcertsearch.org/api/client/v1/cb/ce-name-by-guid")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Put.new(url)
request["x-http-authorization"] = "<<API_KEY>>"
request["Content-Type"] = "application/json"
request["User-Agent"] = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"
request.body = JSON.dump({
  "company_guid": "string",
  "company_name": "string"
})

response = https.request(request)
puts response.read_body

```

{% endtab %}

{% tab title="Python" %}

```python
import http.client
import json

conn = http.client.HTTPSConnection("api.iafcertsearch.org")
payload = json.dumps({
  "company_guid": "string",
  "company_name": "string"
})
headers = {
  'x-http-authorization': '<<API_KEY>>',
  'Content-Type': 'application/json',
  'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36'
}
conn.request("PUT", "/api/client/v1/cb/ce-name-by-guid", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.iafcertsearch.org/api/client/v1/cb/ce-name-by-guid',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_POSTFIELDS =>'{
    "company_guid" : "string",
    "company_name" : "string"
}',
  CURLOPT_HTTPHEADER => array(
    'x-http-authorization: <<API_KEY>>',
    'Content-Type: application/json',
    'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Java" %}

```java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"company_guid\" : \"string\",\r\n    \"company_name\" : \"string\"\r\n}");
Request request = new Request.Builder()
  .url("https://api.iafcertsearch.org/api/client/v1/cb/ce-name-by-guid")
  .method("PUT", body)
  .addHeader("x-http-authorization", "<<API_KEY>>")
  .addHeader("Content-Type", "application/json")
  .addHeader("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36")
  .build();
Response response = client.newCall(request).execute();
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
var axios = require('axios');
var data = JSON.stringify({
  "certificate_number": "string",
  "certification_status": "string",
  "certificate_accreditation_status": "string",
  "certification_type": "string",
  "certification_scope": "string",
  "certification_original_issue_date": "string",
  "certification_issue_date": "string",
  "certification_expiry_date": "string",
  "certified_entity_name": "string",
  "certified_entity_english_name": "string",
  "certified_entity_trading_name": "string",
  "certified_entity_unique_id": "string",
  "certified_entity_street_address": "string",
  "certified_entity_street_city": "string",
  "certified_entity_state": "string",
  "certified_entity_post_code": "string",
  "certified_entity_country": "string",
  "certified_entity_website": "string",
  "accreditation_body_name": "string",
  "accreditation_body_acronym_name": "string",
  "schemes": [
    {
      "scheme_name": "string",
      "standard_list": [
        {
          "standards_name": "string"
        }
      ]
    }
  ],
  "sites": [
    {
      "street": "string",
      "city": "string",
      "state": "string",
      "country": "string",
      "postcode": "string",
      "scope_description": "string"
    }
  ]
});

var config = {
  method: 'post',
  url: 'https://api.iafcertsearch.org/api/client/v1/cb/upload-cert',
  headers: { 
    'Content-Type': 'application/json', 
    'x-http-authorization': '<<API_KEY>>'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.iafcertsearch.org/api/client/v1/cb/ce-name-by-guid"
  method := "PUT"

  payload := strings.NewReader(`{`+"
"+`
    "company_guid" : "string",`+"
"+`
    "company_name" : "string"`+"
"+`
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("x-http-authorization", "<<API_KEY>>")
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
var client = new RestClient("https://api.iafcertsearch.org/api/client/v1/cb/ce-name-by-guid");
client.Timeout = -1;
var request = new RestRequest(Method.PUT);
request.AddHeader("x-http-authorization", "<<API_KEY>>");
request.AddHeader("Content-Type", "application/json");
client.UserAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36";
var body = @"{
" + "\n" +
@"    ""company_guid"" : ""string"",
" + "\n" +
@"    ""company_name"" : ""string""
" + "\n" +
@"}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
```

{% endtab %}
{% endtabs %}
